Mac OS X Webserver

Discussion in 'macOS' started by Archive, Sep 17, 2007.

  1. Archive macrumors member

    Aug 23, 2007

    I have my webserver activated in the system preferences and everything worked fine. My friends on the net could access my page by just typing http://IP/~username.

    But suddenly, that adress bar gets replaced with my local host name or network ID. Even over the internet! Which of course leads to them not being able to connect, since I am not on their network.

    Any help is greatly appreciated, especially since this technicality is difficult to research on google.
  2. Cromulent macrumors 603


    Oct 2, 2006
    The Land of Hope and Glory
    Do you have a permanent IP address from your ISP? Does your router use NAT? Have you set Apache up to use the permanent IP address (if have one)?

    Edit : Oh and what IP address is it that your friends are using to access your machine? If it starts 192.168 it won't work.
  3. mkrishnan Moderator emeritus


    Jan 9, 2004
    Grand Rapids, MI, USA
    Are you saying that a person who is not on your local network points to your computer using the ip-address/~yourusername format, and then automatically gets redirected to local-name/~yourusername?

    Were the computers previously on your local network?

    Have you tried emptying their browser history and re-trying?

    Have you made sure that, if you are not using DynamicDNS and/or don't have a static IP address, that your ISP has not dynamically assigned you a new IP address upon lease renewal?
  4. angelwatt Moderator emeritus


    Aug 16, 2005
    It may be how the links are setup. If you have the status bar shown in your browser, check to see what it says. It also may be something you can remedy in the Apache configuration (httpd.conf), but would need more details of what is going on.
  5. Phil A. Moderator

    Phil A.

    Staff Member

    Apr 2, 2006
    Shropshire, UK
    I've noticed that too and it's very annoying! Not sure what causes it, but I have found a workaround that seems to work (at least on my setup): If you use the full URL (including the page name) the machine address doesn't get re-written and things seems to work from there on. So, if your start page is index.php, putting http://IP/~username/index.php in as the address should work. Good luck!
  6. Archive thread starter macrumors member

    Aug 23, 2007
    You have understood the problem correctly. The computers were never previously on my local network. I have dynamic IP addresses from my ISP, but I use dynamic DNS and can always check my current IP.

    For instance when I try website analysis tools ( and I give in either my Internet IP or my DynamicDNS name I get an error and it displays my local Network name. This is VERY irritating since anybody who knows my Internet IP can now check my Network Name without being on my Network.

    The workaround from Phil A. works. Thanks man!

    But this is truly disturbing....I have just used a number of website checks at and if I don't use this workaround those websites really CAN spy my Network that a security risk, or are they supposed to be able to do that?
  7. caMi macrumors regular

    Sep 13, 2007
    I had the same exact problem until another user on here helped me out.

    Here is how to fix it:

    Open up Terminal and use the command cd /etc/httpd to navigate to that directory. Now use the command sudo nano httpd.conf to open the configuration file for editing in root mode. It will ask you for your password.

    Once you have the file open, you're going to want to panic. Don't. Press Control-w, and then type UseCanonicalName and press Enter. The cursor should jump to the spot in the file where that directive is. Use the arrow keys and the delete key to get rid of "On" and replace it with "Off". Now press Control-o followed by Enter to write (save) the file, then Control-x to exit the nano editor.

    Now, still in the terminal, run sudo apachectl restart. That should restart the Apache web server. Let me know what happens, or if you get stuck.
  8. Archive thread starter macrumors member

    Aug 23, 2007
    That did it!

    Thank you very much!
  9. vanmacguy macrumors 6502a

    Aug 13, 2007
    Not where you live.
    You know, you've got to love these forums. So many helpful and knowledgeable people.
  10. caMi macrumors regular

    Sep 13, 2007
    No problem.

    Glad I could help you with something that was very frustrating for myself! :D

Share This Page