Reputation: 694
As my home network grows, I am finding that I would like to get more access from the outside world and it seems this requires me to grow beyond port forwarding in my router. I have several systems (mostly virtualized) that use ports 80 and 443 (mostly) and I cannot forward those ports to multiple IP addresses. This is where I planned to use Reverse Proxy.
I am testing this on an Ubuntu 12.04 LTS system running Apache2. I have created a file called reverseprox in /etc/apache2/sites-available as follows:
root@server:/etc/apache2# cat sites-available/reverseprox
<VirtualHost *:80>
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ServerName ws.myDomain.asuscomm.com
ServerAlias ws
ProxyRequests Off
ProxyPass / http://192.168.1.64:80/
ProxyPassReverse / http://192.168.1.64:80/
</VirtualHost>
I followed the tutorial from here: http://www.linuxjournal.com/content/protect-your-ports-reverse-proxy?page=0,1
My web server is on 192.168.1.64 on my local network. I have an Asus router and am using Asus DDNS service setup as myDomain.asuscomm.com
. I have also setup all the sym-links as required for Apache to find the necessary modules and get no errors when I restart the apache2 service (except for complaints about the loopback address in the 000-default file). I have forwarded port 80 in my router to the system running apache (on 192.168.1.62) and can see the blank "It Works!" web page so it is clear that myDomain.asuscomm.com:80 is getting to 192.168.1.62 but my VirtualHost doesnt seem to do anything when i enter ws.myDomain.asuscomm.com
.
Am I missing something? Is it the fact that I am using the Asus DDNS service and myDomain.asuscomm.com is not a valid domain name? I have no problem registering a domain name to get this to work if needed. I plan to expand this to my other systems, like nas.myDomain.asuscomm.com, vSphere.myDomain.asuscomm.com, etc...
I appreciate the help!
Upvotes: 1
Views: 4586
Reputation: 694
I figured this out. I was never able to use the DDNS name directly. The solution was to pay some $$$ and register a domain name. I used NameCheap.com and registered a domain name with premium DNS service and privacy protection for $15/year.
Then, I created CNAME records of my desired URL's and set the targets to be my DDNS URL. Once the DNS servers were updated with the new CNAME records (took about 15 min), bingo! Reverse proxy works!
For example, I registered myDomain.com
. In my NameCheap account settings under advanced DNS options (should be the same concept with other domain register services like GoDaddy), I defined a CNAME record with Host
set to ws.myDomain.com
and with a Target
set to myDomain.asuscomm.com
.
Now ws.myDomain.com
gets defined in the DNS and resolves to my Asus DDNS address. From there it gets forwarded to my Proxy server on 192.168.1.62
and directed to 192.168.1.64:80
by means of the VirtualHost definition. And with additional CNAME record definitions for other hosts, you can define additional VirtualHosts in the Proxy server to access other machines and resources. Neat!
Cheers!
Upvotes: 4