Configuring Apache and NAT

Q I have Mandrake 10.1 with Apache running my own website in Apache's default document root. A friend asked if I could host his site with his DNS (www.somename.com). I said yes and thought it would take about ten minutes to set up, but as I read Server School Apache from the Complete Linux Handbook's 1 and 2, it didn't seem like it was going to be quite so simple a process. So far, I've simply gone to www.no-ip.com and added his chosen domain to my account, as well as my own. I thought that the next step was to add him to a user account on my system and so I created /home/somename/html and put his website in the html dir. When I tried http://localhost, it came up with my site, so I thought I'd try his www.somename.com site, but it came up with my router's login page and not his. What am I doing wrong here? Here's a copy of my Vhosts.conf, if that helps:

NameVirtualHost 192.168.0.5
<VirtualHost 192.168.0.5>
ServerName www.somename.com
#ServerPath /domain
DocumentRoot /home/somename/
html
</VirtualHost>

A If you're seeing your router configuration page when you connect, it sounds more like a network issue than an Apache configuration problem. You'll need to permit port 80 through your outer and NAT it onto the 192.168.0.5 internal address.

If you're hosting your own site, here should already be a rule. However, as you were accessing it via 'localhost' rather than its real outside address, there could be a DNS misconfiguration at some point. Your Apache VirtualHosts configuration appears to be correct, and you should be able to see successful requests in the access_log file to verify that the appropriate DocumentRoot entry is being hit. You'll also need to add a VirtualHost entry for your own site, as well as localhost, because once NameVirtualHost is used, the default DocumentRoot configuration options ignored.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar