Hosting Rails Apps On My Home Servers
When I heard that Markus Frind of plentyoffish.com actually started hosting his website from home, I thought it would be interesting to post my recipe for hosting websites and Rails apps from home servers. However, it’s not as easy just plugging it in. There are interesting constraints I have to overcome, and I expect that others are having the same problem.
Problems
Although I have plenty of bandwidth from my FiOS, any incoming traffic to port 80 and 8080 are blocked by Verizon. I found this to be true when I had both DSL and cable modem. What this means is that the only way for the visitors to view my site, it has to point to some obscure port. I just don’t think this will work.
Another issue is that my IP address is from DHCP. Although it hasn’t changed since I got it, you never know. I also don’t want to pay more for a fixed IP address and certainly don’t want to be a subject to the interrogation of “why do you need a static IP?” from Verizon.
My Recipe
As you can see by the diagram, I got a basic VPS that functions as the proxy and a stripped down load balancer. You can get a cheap VPS for as little as $9.99 per month. Since it’s not doing much, you don’t need cPanel/Plesk or any other software, just Apache or my favorite, nginx.

Next thing I have is a dynamic DNS provider such as dyndns.org. The host name specified here will be the address of my home server. This solves the issue with changing IP address. My server also updates the IP address by running a small daemon.
The Apache server running on the VPS, which comes with a static IP address and the access to port 80, sends the request from client to my server at home using obscure port. My home server sends the response back and the user can’t tell the difference. You can also host many sites this way. Below is a bit of sample configuration on Apache:
Apache config:
<Proxy balancer://cluster_name>
BalancerMember http://home_server_address:8000
BalancerMember http://home_server_address:8001
</Proxy>
Virtual directive:
ProxyPass / balancer://cluster_name/ ProxyPassReverse / balancer://cluster_name/
Discussion
If you’d like to get more details or have questions, just send me an email at my name at this domain.
Comments
2 Responses to “Hosting Rails Apps On My Home Servers”
Leave a Reply
You must be logged in to post a comment.
well done, bro
Thanks. Just one more thing. If you need to create a secure connection between the VPS and the home server(s), try using ssh tunnel rather than VPN. It’s faster and relatively secure.