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

JustinS

macrumors newbie
Original poster
Feb 20, 2006
4
0
Blacksburg, VA
Here is the situation...

I have enabled personal web-sharing on my iMac. I have also set it up to listen on port 81 by editing /etc/httpd/httpd.conf. The reason for this is that my ISP blocks port 80. My linksys WRT54g router is set to forward all requests on port 81 to the local ip address, 192.168.1.105. This local ip address is essentially static as it is obtained using manual dhcp.

Here is where it gets weird...

All requests to port 81 my WAN ip address, which is currently 24.53.134.137, correctly forward to the index file in /Library/WebServer/Documents. However, entering http://24.53.134.137:81/~justin/ does not resolve. Instead, it attempts to load http://justins-imac-g5.local/~justin. Since this is an invalid address, the page fails to load when access from outside of my lan. This problem also exists with subfolders within the document root (ie http://24.53.134.137:81/testfolder).

How do I get Apache to serve pages from any folder other than "/Library/WebServer/Documents". Specifically how would I get http://publicipaddress:81/~justin to correctly forward to http://192.168.1.105:81/~justin instead of http://justins-imac-g5.local:81/~justin ?

EDIT:
I also have my router set up with DynDNS in case the IP address changes. That address is http://jsurratt.dyndns.tv:81
 
When I go to http://24.53.134.137:81/~justin/, I see this:
Justin.png


Seems OK to me.

If you want to use an easier name, go to DynDNS.org and get a free domain name.

Edit: I see you did. And, oddly, http://jsurratt.dyndns.tv:81/~justin doesn't work, whereas the IP did. And still does.
 
One comment on the subfolders - all the files need to be readable by anyone, or else it won't work - you see them because, of course, you're logged on as you, but Apache isn't, so it needs read access.
 
HA! At least it's working for someone!

There must be some type of law that whenever you're finally desperate enough to post a problem on a forum it will magically resolve itself. I'm going to try to check it from the library (rather than my neighbor's computer) later on to see if it's just my ISP being weird.
 
You can get directories to work as aliases by creating a symbolic link:
Code:
cd /Library/WebServer/Documents
ln -s /Users/justin/Sites justin
and then allowing it in the "IfModule mod_alias.c" section of httpd.conf:
Code:
<IfModule mod_alias.c>
    <Directory "/Library/WebServer/Documents/justin">
        Options Indexes FollowSymlinks MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>
Which doesn't get the _justin to work, per se, but should accomplish what you want.

Edit: meaning you'd get to it by http://jsurratt.dyndns.tv:81/justin
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.