Previous 1 2 Next 21 Replies Latest reply: Jun 27, 2008 12:11 AM by EarthStationOahu
Allen Watson1 Level 1 (15 points)
When I attempt to set my browser to a URL like:


I get a message telling me, "Forbidden: you do not have access to blah-blah on this server."

Yet, if I boot back into Tiger and try the exact same thing, it works fine. Same user (AllenW) in both cases. I have no other trouble with file permissions.

Any suggestions, anyone?

Macbook (1st gen) 2GB RAM, Mac OS X (10.5)
  • Allen Watson1 Level 1 (15 points)
    Would someone else try this and let me know if you see the same problem? Create an index.html file in your Sites folder, then enable web sharing and try to access it from a browser using:


    What happens?
  • jewhanso Level 1 (0 points)
    I am also having trouble with web sharing in Leopard. I've turned it on under system preferences and can't even access the server. It appears to be running but regardless of whether I type in the IP address, use or use localhost it comes up with the following message.

    +Safari can’t connect to the server.+
    +Safari can’t open the page “http://localhost/~YourUserName/” because it could not connect to the server “localhost”.+

    I tried what you suggested and cannot view the file either.

    Does anyone have any idea what the issue is or how to fix it.
  • matt kelly1 Level 1 (15 points)
    I'm having the same problem. Have you found a solution?
  • wHaTEvEr- Level 1 (0 points)
    Humm... I kind of talked about it just now on other thread :\
    take a look

    or go directly here (bottom of the page) and see if it helps you... didn't work for me though...
  • lethal Level 2 (435 points)
    Leopard uses Apache 2. Tiger used Apache 1.3.

    Your config works on tiger because the appropriate user.conf files are in the Apache 1.3 path. They are not moved during an upgrade.

    Under this path: /etc/apache2/users

    I have a file for each user:


    Where user1.conf contains:

    <Directory "/Users/user1/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all

    I hope that helps.

    I also updated my php using the latest entropy package... as I had the Apache 1.3 version installed before. See
  • wHaTEvEr- Level 1 (0 points)
    redundant threads.... BAH

    You need to have a file named <your_username>.conf in /private/etc/Apache2/users/ for Apache to work properly. Probably you don't have it there or you wouldn't be here :P...
    The file might exist in /private/etc/Apache2/users/<yourusername>.conf and if it does, just copy it to the first folder.
    If it doesn't exist, you may create it with the following contents:

    <Directory "/Users/<yourusername>/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all

    Don't forget to change "<yourusername>"...

    Now I belive that you just need to restart Apache on the Sharing Pref. Pane and you're good to go...
  • jewhanso Level 1 (0 points)
    I've tried all of the suggestions that have been posted thus far and still no luck. I've restarted the web sharing as instructed after making the changes and I still get the response:
    "Safari can’t connect to the server.
    Safari can’t open the page “http://localhost/” because it could not connect to the server “localhost”."

    Maybe it's something simple, maybe it's not, but it sure has me stumped.

    Has anyone else who has had this problem had success with the posted solutions?
  • RetiredToWrite Level 1 (0 points)
    You suggest copying a file "to the first folder", but the two paths you give are identical. Huh?

    It looks to me as if /private/etc/apache2/users and /etc/Apache2/users point to the same directory; when I cd to them and ls, I see the same three files including the "AllenW.conf" file I created as instructed here. I am still getting the message in Safari, 'Safari can’t open the page “http://localhost/~AllenW/” because it could not connect to the server “localhost”.'

    I've also been to and have followed those instructions, to no avail.
  • matt kelly1 Level 1 (15 points)
    Evidently there were changes moving to Leopard that haven't been documented nor worked out yet. To solve this I simply downloaded XAMPP. It installs all the necessary packages and allows easy management.
  • RetiredToWrite Level 1 (0 points)
    I took the suggestion to download and install XAMPP. And it worked. The only "problem" was that it expects to find websites in a different location. Rather than "Sites" the websites are expected to be in /Applications/xampp/htdocs/. Once I moved my site folder there, everything works. There is some helpful documentation at
  • So Glitchy Level 1 (0 points)
    This one had me losing some hair for a while, too, but I got it running again, after of course doing everything recommended here -- the problem seemed to be that apache was looking for its log directory, and there wasn't one. (I figured this out while trying to read the ErrorLog, which should have been the first thing I did, but live and learn.)

    So, in the finder, Go > Go To Folder, and type /private/var/log.

    There should be a folder called apache2 in that directory. If there's not, that's a problem (although I wouldn't dare assume it's the only one).

    To make sure, check out the system log by double-clicking on the file in the directory called system.log. When I did that with the web server (supposedly) running, I saw this:

    Jan 4 20:42:32 Hatter org.apache.httpd[1028]: (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log.
    Jan 4 20:42:32 Hatter org.apache.httpd[1028]: Unable to open logs
    Jan 4 20:42:32 Hatter[1] (org.apache.httpd[1028]): Exited with exit code: 1
    Jan 4 20:42:32 Hatter[1] (org.apache.httpd): Throttling respawn: Will start in 10 seconds
    Jan 4 20:42:42 Hatter org.apache.httpd[1029]: (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log.
    Jan 4 20:42:42 Hatter org.apache.httpd[1029]: Unable to open logs
    Jan 4 20:42:42 Hatter[1] (org.apache.httpd[1029]): Exited with exit code: 1
    Jan 4 20:42:42 Hatter[1] (org.apache.httpd): Throttling respawn: Will start in 10 seconds

    over and over, every ten seconds, for as long as the web server was active.

    To fix that, just create that directory. Turn off the webserver, then from terminal:

    mkdirhier /private/var/log/apache2/

    and restart the webserver.
  • Terry Mahoney Level 1 (35 points)
    Same problem for me - I also tried all above suggestions (re. conf files and paths). As jewhanso says, I (also) get the message: Safari can’t open the page "http://localhost/..." because it could not connect to the server "localhost".

    Leopard seems to lack a way of designating the local loopback address. Maybe this is IP v.6-related?

    Does anybody know how to properly specify the local loopback address in IP V.6? Maybe that will work. I tried using both http://localhost/~mydir/index.php and They work fine on my Tiger-based MacBook but not under Leopard.

    Interestingly - in Leopard, the Apple > System Preferences > Sharing checkbox reads "Web Sharing" (using an external network address). In Tiger this is "PERSONAL Web Sharing" (using the local loopback address). The editing text-boxes disallow the use of 'localhost' or ''.

    There's an interesting error message in the apache2/error_log that reads "[Sat Feb 16 20:05:00 2008] [error] [client ::1] File does not exist: /Users/<mydir>/Sites/sites. Note the '... [client::1] ...' syntax. I don't know for sure but I am guessing this is an IP v.6 syntax - replacing the older syntax for the loopback address. I.e. localhost = IP address".

    Looks like an Apple "faux pas" to me. :-/
  • Terry Mahoney Level 1 (35 points)
    I FOUND the source of MY problem (localhost access not working under leopard - 10.5.2). I had unintentionally corrupted the httpd.conf file in /private/etc/apache2 when I edited it using TextWrangler. Not realizing what I was doing, I had used TextWrangler >Text > Add/Remove line numbers instead of TextWrangler > View > Text Display > Show Line Numbers, which prefixed/prepended the text of the line numbers to the lines in the saved file. :-/

    The result was that Apache had not processed the httpd.conf file. I discovered this by testing Apache from Terminal using the 'sudo apachectl -t' comand. The resulting error message indicated a "syntax error on line 1" and displayed the line as "1 #" - making the problem obvious.

    Fixing this (after having followed the directions in and then stopping and restarting Apache left me with Apple's stock Apache 2 running and PHP 5 testing out perfectly.
  • j4m3s Level 1 (0 points)
    Awesome! This lead me to the fix for MY problem as well ("cannot connect to server" error).

    I ran "sudo apachectl -t" in the terminal and got this:

    httpd: Syntax error on line 116 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/ into server: dlopen(/usr/libexec/apache2/, 10): image not found

    Makes sense...there is no PHP4. I went to /private/etc/apache2/httpd.conf, commented line 116 (and subsequently un-commented line 114 for PHP5), restarted Web Sharing and Boom! It works!

    Thanks Terry, for the clue!
Previous 1 2 Next