Issue with serving a webpage on os x

Discussion in 'Web Design and Development' started by mdzwolf, Jun 11, 2006.

  1. mdzwolf macrumors member

    Joined:
    Oct 13, 2005
    #1
    I set up a website with PHP and mysql and it works fine on my machine. apache is running and I can log in, view pages ect. However when I try to access the site from another machine either on the same subnet or from another location ie parents house, it doesn't work. I give them my external ip, which is forwarded to my machine, but link translate back to voyager.local which is my machine address. so for example I give them.

    http://mdzwolf.dnsalias.net/~markzalewski/classpop
    but it translate back to
    http://voyager.local/~markzalewski/classpop

    And they get a page cannot be displayed, however when they drop off everything after mdzwolf.dnsalias.net it brings them to the standard apache page. As soon as they add ~markzalewski it give them a page cannot be display and the address changes to voyager.local. This happens on machine on the same network ie same house, and machines in different cities.

    does anybody know why? This is driving me crazy. I am the only one that can see my webpage!

    Any help would be greatly appreciated.

    -Mark
     
  2. Blackheart macrumors 6502a

    Blackheart

    Joined:
    Mar 13, 2004
    Location:
    Seattle
    #2
    Have you already checked possible firewall issues?
     
  3. mdzwolf thread starter macrumors member

    Joined:
    Oct 13, 2005
    #3
    The os x firewall is off and I made my internal ip address the DMZ host on the router.
     
  4. gekko513 macrumors 603

    gekko513

    Joined:
    Oct 16, 2003
    #4
    I think I know why it happens, but I have no quick solution.

    When the server looks up the ~ to find your user's web directory, it also looks up your computer's hostname. You computer thinks that it's voyager.local and doesn't know about the dnsalias DNS lookup that you've set up for it.

    Solutions could be found by exploring one of the following:
    1. find a way of changing the hostname on your Mac
    2. don't host your web page as a user, host it on the "root level" (http://mdzwolf.dnsalias.net/classpop).
    3. change the behaviour of the ~ lookup by changing some config somewhere.

    Option 2 should be easy, you just need to find the folder where apache looks for non-user-specific web content.
     
  5. Blackheart macrumors 6502a

    Blackheart

    Joined:
    Mar 13, 2004
    Location:
    Seattle
    #5
    Anything interesting in the httpd access and error logs on the host computer?
     
  6. Blackheart macrumors 6502a

    Blackheart

    Joined:
    Mar 13, 2004
    Location:
    Seattle
    #6
    /Library/WebServer/Documents/

    This can be changed in the file:

    /etc/httpd/httpd.conf
     
  7. mdzwolf thread starter macrumors member

    Joined:
    Oct 13, 2005
    #7
    Ok I tried option two and put my website folder into the /Library/WebServer/Documents/ folder and machines other then mine still change the ip address to voyager.local. I just don't understand why this is happening.
     
  8. gekko513 macrumors 603

    gekko513

    Joined:
    Oct 16, 2003
    #8
    Then it looks up the hostname no matter what. You must find a way to make the reverse lookup from your ip on your Mac to be the same as you want it to be externally.

    I'll search around... Edit: This could work... You must edit the file /etc/hostconfig like this:
    You'll want to replace -AUTOMATIC- with mdzwolf.dnsalias.net
     
  9. mdzwolf thread starter macrumors member

    Joined:
    Oct 13, 2005
    #9
    Ok I changed the hostconfig file and made HOSTNAME=192.168.1.101 which is my internal ip address just for testing purposes. I went to another machine on the network and it still changed the 192.168.1.101 to voyager.local. However on my machine when I typed in the ip address instead of changing to voyager.local it went to 127.0.0.1.
     
  10. gekko513 macrumors 603

    gekko513

    Joined:
    Oct 16, 2003
    #10
    OK, we're getting more advanced here... how about trying changing /etc/httpd/httpd.conf

    Find the line
    #ServerName new.host.name

    And underneath it, add a line
    Servername 192.168.1.101

    (or mdzwolf.dnsalias.net of course)
     
  11. mdzwolf thread starter macrumors member

    Joined:
    Oct 13, 2005
    #11
    No that didn't work either. Should I be having this issue, I mean does anybody serve personal webpages from their mac?

    Oh by the way, thanks for everyone's help so far.
     
  12. mdzwolf thread starter macrumors member

    Joined:
    Oct 13, 2005
    #12
    UPDATE: I changed the port number apache was listening on and now it works. I have no idea why changing it from 80 to 8080 works, but I just want to say thanks again for everyones help. If anybody know why this worked, or ways to fix this problem so I can go back to 80 I would love to hear them.

    -Mark
     
  13. gekko513 macrumors 603

    gekko513

    Joined:
    Oct 16, 2003
    #13
    Have you tried going back to 80 again? Maybe the previous config change didn't kick in because apache wasn't restarted properly.
     
  14. jrogers macrumors newbie

    Joined:
    Dec 8, 2005
    Location:
    Sunny Florida
    #14
    similar setup

    I am running a server here inhouse similar to what you have, php with mysql database serving outside clients. I never had to mess with the ports on the firewall. What router are you running?

    I simply put the php files in a folder in /Documents directory. I am interested to see if you can figure out why you can not see it from outside?

    I have the machine dmz'd through the router with the external IP pointing to the LAN address.
     
  15. radiantm3 macrumors 65816

    radiantm3

    Joined:
    Oct 16, 2005
    Location:
    San Jose, CA
    #15
    Not sure why it didn't work internally, but lots of ISPs block port 80 and 21 from the outside so you can't host and serve from home.
     

Share This Page