Help with Personal Web Sharing / Port Forwarding

Discussion in 'macOS' started by JustinS, Feb 20, 2006.

  1. JustinS macrumors newbie

    Joined:
    Feb 20, 2006
    Location:
    Blacksburg, VA
    #1
    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
     
  2. jsw Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
    #2
  3. jsw Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
    #3
    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.
     
  4. JustinS thread starter macrumors newbie

    Joined:
    Feb 20, 2006
    Location:
    Blacksburg, VA
    #4
    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.
     
  5. jsw Moderator emeritus

    jsw

    Joined:
    Mar 16, 2004
    Location:
    Andover, MA
    #5
    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
     
  6. JustinS thread starter macrumors newbie

    Joined:
    Feb 20, 2006
    Location:
    Blacksburg, VA
    #6

Share This Page