Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mdzwolf

macrumors member
Original poster
Oct 13, 2005
36
5
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
 

mdzwolf

macrumors member
Original poster
Oct 13, 2005
36
5
The os x firewall is off and I made my internal ip address the DMZ host on the router.
 

gekko513

macrumors 603
Oct 16, 2003
6,301
1
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.
 

Blackheart

macrumors 6502a
Mar 13, 2004
938
0
Seattle
gekko513 said:
Option 2 should be easy, you just need to find the folder where apache looks for non-user-specific web content.

/Library/WebServer/Documents/

This can be changed in the file:

/etc/httpd/httpd.conf
 

mdzwolf

macrumors member
Original poster
Oct 13, 2005
36
5
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.
 

gekko513

macrumors 603
Oct 16, 2003
6,301
1
mdzwolf said:
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.
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:
In /etc/hostconfig, I changed
HOSTNAME=-AUTOMATIC-
replacing -AUTOMATIC- with my full-qualified hostname so my hostname doesn't change as I change networks.
You'll want to replace -AUTOMATIC- with mdzwolf.dnsalias.net
 

mdzwolf

macrumors member
Original poster
Oct 13, 2005
36
5
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.
 

gekko513

macrumors 603
Oct 16, 2003
6,301
1
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)
 

mdzwolf

macrumors member
Original poster
Oct 13, 2005
36
5
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.
 

mdzwolf

macrumors member
Original poster
Oct 13, 2005
36
5
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
 

gekko513

macrumors 603
Oct 16, 2003
6,301
1
Have you tried going back to 80 again? Maybe the previous config change didn't kick in because apache wasn't restarted properly.
 

jrogers

macrumors newbie
Dec 8, 2005
4
0
Sunny Florida
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.
 

radiantm3

macrumors 65816
Oct 16, 2005
1,022
0
San Jose, CA
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.