Personal Web Sharing Not Working

Discussion in 'Mac Apps and Mac App Store' started by wakerider017, Mar 19, 2007.

  1. wakerider017 macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #1
    Hey guys,

    I had this running before and for some reason it is not working now.

    I can access the "Sites" folder from my computer, but I can not access it from any other computer on my LAN. (using address 192.168.1.2/~talsma) This has never been an issue before. Additionally I can not access it from my public IP. (using address 843.324.54.20/~talsma NOTE: That is a fake IP, I did not want to disclose my actual IP) Again I have always been able to do this...

    I have Personal Web Sharing Checked in "sharing" and I forwarded ports 0-80 on my router. I am connected to my LAN and internet just fine.

    What gives?
     
  2. ebouwman macrumors 6502a

    Joined:
    Jan 5, 2007
    Location:
    Canada
  3. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #3
    No I have a static IP.

    It is always 192.168.1.2

    I got sick of it changing on me every day.
     
  4. ebouwman macrumors 6502a

    Joined:
    Jan 5, 2007
    Location:
    Canada
    #4
    did you check to see that it was still the same? maybe your router got reset or somebody messed with it,
     
  5. ebouwman macrumors 6502a

    Joined:
    Jan 5, 2007
    Location:
    Canada
    #5
    i dont' mean to imply your an idiot just wondering
     
  6. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #6
    Yup

    Still 192.168.1.2

    It can't change b/c it is manually assigned.


    [​IMG]
     
  7. ebouwman macrumors 6502a

    Joined:
    Jan 5, 2007
    Location:
    Canada
    #7
    did you try
    http://Nick Talsma's Computer.local/~talsma
    also i think that the name is case sensitive
     
  8. someguy macrumors 68020

    someguy

    Joined:
    Dec 4, 2005
    Location:
    Still here.
  9. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #9
    1 router 1 switch
     
  10. someguy macrumors 68020

    someguy

    Joined:
    Dec 4, 2005
    Location:
    Still here.
    #10
    I believe the computers have to be connected to the same router/switch for this to work the way you are trying to do it. Try plugging them both into either the router or the switch, check your local IP, and try again.
     
  11. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #11
    No, they don't. That's the whole point of a switch, to expand your network transparently.

    Wakerider, you haven't mentioned yet (and I can't believe none of you have asked) what the exact error is when you attempt to access the web server on your machine from another computer. Is it a 404? A 500? Please provide more detail.
     
  12. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #12
    On all computers both local and over the internet it says this:

    [​IMG]


    It has to be working somwaht other wise how would it know the name of my computer?
     
  13. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #13
    That implies it can't resolve the name to an IP address. And I don't know what you mean when you say "It has to be working somwaht other wise how would it know the name of my computer?" That doesn't make sense.

    First, try accessing it with the IP address, not the name. http://192.168.1.2/~talsma. That should work. If it doesn't, please post the error it gets here. I need to know that because it's probably not the same error as when you're trying to use the name.
     
  14. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #14
    When I type "192.168.1.2/~talsma" it automatically redirects to "http://nick-talsmas-computer.local/~talsma/"

    I never type out "http://nick-talsmas-computer.local/~talsma/" all the computers do it by itself.


    Same thing happens when I type in my public IP.

    Mr Rogers. I just sent you a PM.
     
  15. weldon macrumors 6502a

    weldon

    Joined:
    May 22, 2004
    Location:
    Denver, CO
    #15
    Here's a couple things to try...

    • Can you access the internet from this computer?
    • Stop and then start Personal Web Sharing again
    • from this computer, try to access "http://127.0.0.1/" and see if you get the Apache home page
    • from another mac, open network utility and ping 192.168.1.2
    • from another mac, open network utility and run port scan against 192.168.1.2 and see if there is a response on port 80
    • from the web browser on another computer, try to access "http://192.168.1.2" and see what happens. Don't forget the http://
    Try those things and report back. I'll try and give you some direction once we know what is happening better.
     
  16. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #16
    I got your PM and see what you mean. I can identify what's happening, but I don't know what's causing it.

    The reason you can't access the site on any computer but the one it actually lives on is because of that redirection -- other computers have no idea what "nick-talsmas-computer.local" is (what IP it should be associated with).

    One temporary fix you can try is to add the line

    Code:
    192.168.1.2       nick-talsmas-computer.local
    to another local computer's /etc/hosts file. That will probably work. However, you shouldn't have to do that. My guess is that there's some setting somewhere for the Apache server built into OS X that is doing this -- I don't use OS X for hosting sites, I use Linux, so I'm not sure why that might be happening. I'll think on it and get back to you.

    EDIT: For your reference, weldon, he does have Apache running; he gave me his public IP and I checked it out. His physical network connectivity is OK, so we've in effect taken care of all those bullet points.
     
  17. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #17
    wakerider, I think I may have found your problem. In the /etc/httpd/httpd.conf file, there is this:

    Code:
    # UseCanonicalName:  (new for 1.3)  With this setting turned on, whenever
    # Apache needs to construct a self-referencing URL (a URL that refers back
    # to the server the response is coming from) it will use ServerName and
    # Port to form a "canonical" name.  With this setting off, Apache will
    # use the hostname:port that the client supplied, when possible.  This
    # also affects SERVER_NAME and SERVER_PORT in CGI scripts.
    # 
    UseCanonicalName On
    That directive is what's causing the problem. It's returning the machine's name (nick-talsmas-computer.local) to the clients that are trying to access it -- however, as I said before, that name means nothing to other computers. Change that "On" to "Off", restart Apache, and you should be good to go.
     
  18. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #18
    Great!

    but...


    1. I am not sure where that file is located... (where is the etc folder?)

    2. Where is the apache program? I am not sure but I think the apache utility came installed with 10.4. I have no idea where the actual apache control panel is. (I don't even have a clue how to make it so a website shows up at "http://192.168.1.2/"... I do know how to make it show up at "http://192.168.1.2/~talsma" though...)

    I really hope you can help me with this. Sorry for my ignorance.

    I am not a complete idiot though... I used to run Apache Triad on my PC and that worked fine. Plus I have all the hardware setup right :) Just having some trouble with my mac... :(


     
  19. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #19
    Try some simple tests...

    On the machine that runs the web server, bringup a browser and type

    If you get an Apache test page then you are set up OK. If not the server is not running.

    It also helps to read the log files in /var/log/httpd

    Poking around in my system Apple seems to be using a very generic and common Apache setup.
     
  20. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #20
    Spotlight can find the file for you. But look in /etc/httpd/httpd.conf

    the Apache executable is /usr/sbin/httpd

    Control panel? there is none you have to edit httpd.conf to make changes
     
  21. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #21
    ^ ChrisA, we do already know that Apache is running. We were able to get the Apache setup page. That was mentioned earlier in the thread.

    wakerider, sorry I forget that not everyone is used to being a command-line junkie when it comes to server stuff :) 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.
     
  22. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #22
    Apache appears to be working.

    [​IMG]
     
  23. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #23
    Got your PM and tested it...it works! I assume you successfully followed the steps to set UseCanonicalName to Off?
     
  24. wakerider017 thread starter macrumors 68000

    wakerider017

    Joined:
    Sep 20, 2006
    Location:
    US of A
    #24
    Yes your directions were terrific! You are one smart guy.

    Just a few questions though. Is everyones setting like this by default? If so there must not be many people using this feature. Or did my setting get messed up some how?

    Second, Anyway to host at just 192.168.1.2 instead of the ~talsma? (Not really a big deal though.)

    Third, Do you have any link where I can learn how to use terminal better. That is really something I need to learn.

    Thanks so much!

    Your a Mac Genius. :D
     
  25. rogersmj macrumors 68020

    rogersmj

    Joined:
    Sep 10, 2006
    Location:
    Indianapolis, IN
    #25
    You are too kind...I only knew about it not because of my experience with Macs (actually, this is the very first time I've messed around with a Mac as a web server at all), but because I've setup so many Linux servers.

    Just a few minutes ago, I activated Personal Web Sharing on my iMac and tried to access it via IP on my MacBook. I ran into the same problem, and changing the UseCanonicalName setting worked. So it appears it is set this way by default, but a lot of people don't notice it I imagine because they only use the web server from their local computer for development. It doesn't seem right though, because the whole point of the Personal Web Sharing option is to allow others on your network to access your web sites. Odd.

    From a perusal of httpd.conf, it looks like having a site at your computer's root address would involve placing the files in /Library/Webserver/Documents. Optionally, you could (and be careful with this -- make sure you type the path correctly) delete the Documents directory in /Library/Webserver (using the command

    Code:
    [B]sudo rm -rf /Library/Webserver/Documents[/B]
    -- you don't need anything that's in that directory by default) and then create a symlink to your Sites directory using the command

    Code:
    [B]ln -s /Users/talsma/Sites /Library/Webserver/Documents[/B]
    This will place a symbolic link at /Library/WebServer/Documents that will in reality be reading from your Sites directory.

    As far as learning shell (terminal) commands...that's just something I've picked up from years of having a Linux file server.
     

Share This Page