Help with VirtualHosts
I'm trying to host a family website on my OSX machine, but I'm having trouble getting it to act like a "normal" website in terms of what appears on your browser's URL bar. I'm hoping someone can tell me what I'm missing in the configuration.
I registered a domain name, call it myfamily.org. The machine hosting the website has a dynamic IP which rarely changes, but it resolves to a URL including the router info (something like d-123-45-67-89.dhcp.somewhere.com). I set up domain forwarding to forward www.myfamily.org to http://d-123-45-67-89.dhcp.somewhere.com/~myuser. It works great. Anyone who goes to "www.myfamily.org" goes straight to the web page. BUT, once they get there, all the addresses and links appear as "d-123-45-67-89.dhcp.somewhere.com~/myuser" rather than "www.myfamily.org". I'd like it to act like a "real" website, where all the addresses are presented as relative to the domain name, instead of the domain name acting as a mere forwarding address.
I tried turning on NameVirtualHosts in httpd.conf, and adding an entry for my domain name, but it didn't work. What I added looked like:
NameVirtualHost 127.0.0.1:80
NameVirtualHost 123.45.67.89
<VirtualHost 127.0.0.1:80>
DocumentRoot /Library/WebServer/Documents
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName www.myfamily.org
DocumentRoot /Users/myuser/Sites
</VirtualHost>
(The localhost bits are so I could still type "localhost/~someuser" into the machine's web browser and pull up the local sites.) Not only does this not work, but it screws up how the machine responds to other HTTP requests. For example, if try to visit "123.45.67.89/~anotheruser" it shunts the document request to "123.45.67.89~/myuser//~anotheruser". If I add a trailing "/" to the address, however, it still works normally.
What am I doing wrong? All the Googling I've done suggests this should be it. I shouldn't have to worry about NetInfo (I think) unless I want to add new localhost aliases, which I don't think I want to do. Any suggestions?
I registered a domain name, call it myfamily.org. The machine hosting the website has a dynamic IP which rarely changes, but it resolves to a URL including the router info (something like d-123-45-67-89.dhcp.somewhere.com). I set up domain forwarding to forward www.myfamily.org to http://d-123-45-67-89.dhcp.somewhere.com/~myuser. It works great. Anyone who goes to "www.myfamily.org" goes straight to the web page. BUT, once they get there, all the addresses and links appear as "d-123-45-67-89.dhcp.somewhere.com~/myuser" rather than "www.myfamily.org". I'd like it to act like a "real" website, where all the addresses are presented as relative to the domain name, instead of the domain name acting as a mere forwarding address.
I tried turning on NameVirtualHosts in httpd.conf, and adding an entry for my domain name, but it didn't work. What I added looked like:
Code:
NameVirtualHost 127.0.0.1:80
NameVirtualHost 123.45.67.89
<VirtualHost 127.0.0.1:80>
DocumentRoot /Library/WebServer/Documents
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName www.myfamily.org
DocumentRoot /Users/myuser/Sites
</VirtualHost>
(The localhost bits are so I could still type "localhost/~someuser" into the machine's web browser and pull up the local sites.) Not only does this not work, but it screws up how the machine responds to other HTTP requests. For example, if try to visit "123.45.67.89/~anotheruser" it shunts the document request to "123.45.67.89~/myuser//~anotheruser". If I add a trailing "/" to the address, however, it still works normally.
What am I doing wrong? All the Googling I've done suggests this should be it. I shouldn't have to worry about NetInfo (I think) unless I want to add new localhost aliases, which I don't think I want to do. Any suggestions?
Comments
I use http://www.zoneedit.com/ and it works great. It's free up to 5 domains I think, and they don't limit subdomains. They offer some other features too.