Help with VirtualHosts

Posted:
in Genius Bar edited January 2014
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:
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

  • Reply 1 of 3
    toweltowel Posts: 1,479member
    Eh, nevermind. Fundamental misunderstanding of how the web works on my part. I would need to register the domain name with my ISP's DNS servers; setting up domain forwarding doesn't cut it. The lesson is that if I want a "real" website, I need a "real" hosting service.
  • Reply 2 of 3
    If you would use DynDNS's dynamic DNS service (as opposed to the forwarding service) then this would work out for you. Your ISP does not have to be the ones doing DNS work for you.
  • Reply 3 of 3
    ast3r3xast3r3x Posts: 5,012member
    I did the same thing you did, only for swigg.net



    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.
Sign In or Register to comment.