Could someone help me decode my apache2 error_log?
[Sat Nov 19 17:39:59 2011] [error] [client ::1] client denied by server configuration: /Library/WebServer/Documents/Users [Sat Nov 19 17:39:59 2011] [error] [client ::1] client denied by server configuration: /Library/WebServer/Documents/favicon.ico
This folder does not even exist. And most people have a good client address such as 127.0.0.1 but since I'm on Mac OS Lion someone told me to update my hosts file to have this
127.0.0.1 localhost ::1 localhost fe80::1%lo0 localhost
I am not quite sure what the problem is. If I navigate to something such as:
I have no problem and am greeted with the index page (set to start.php by the .htaccess file). However if I try to go to login at:
Which is supposed to be routed to http://localhost/kl/n/login/login.php I get a 403 forbidden access with the errors mentioned above in my apache2 error_log. Now I have no problem actually going to http://localhost/kl/n/login/login.php. It exists and works fine. To see if it was a problem with addresses I created an undefined variable for the error_log to throw and when I access it directly through the full url I get this error in my error_log:
[Sat Nov 19 18:00:32 2011] [error] [client ::1] PHP Notice: Undefined variable: orange2 in /Users/myusername/Sites/cloud/kl/n/styles/colors.php on line 127, referer: http://localhost/kl/n/login/login.php
So for the 403 error to say:
You don't have permission to access /Users/myusername/Sites/cloud/kl/n/login/login.php on this server.
Is a bit odd to me. Any help whatsoever or anything to check would be greatly appreciated. I can't seem to move on as the whole site is heavily relying on these clean urls and that it would also be a great hassle to change all the links now in development and then again on production. Thank you so much.
EDIT 11/21/11 2:42pm: I decided to add some more information to help anyone who's even attempting to help me (Come on guys, I can't be the only one who's had to face this, it seems like something someone else must've run into. No MAMP users with .htaccess rewrites on their server that ran into a 403 forbidden?)
Under my sites folder there is a file called httpd-vhosts.conf and here it is:
<Directory "/Users/myusername/Sites"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory> Alias /kl "/Users/myusername/Sites/cloud/kl" # For http://localhost in the OS X default location <VirtualHost _default_:80> ServerName localhost DocumentRoot /Library/WebServer/Documents </VirtualHost>
Under /etc/apache2/httpd.conf I uncommented the line that would enable php5 and changed these lines:
# If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # #User _www #Group _www User myusername Group _www
I have tried this with both the normal _www and my username, neither helps with the problem. I also changed these lines under /etc/apache2/httpd.conf
# DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # #DocumentRoot "/Library/WebServer/Documents" DocumentRoot "/Users/myusername/Sites" # # Each directory to which Apache has access can be configured with respect # to which services and features are allowed and/or disabled in that # directory (and its subdirectories). # # First, we configure the "default" to be a very restrictive set of # features. # <Directory /> Options FollowSymLinks AllowOverride All Order deny,allow Deny from all </Directory> # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # # # This should be changed to whatever you set DocumentRoot to. # # old path #<Directory "/Library/WebServer/Documents"> # new path <Directory "/Users/myusername/Sites">
Again any help on this would be appreciated. I really hope I'm not the only one who set up a MAMP and had problems with .htaccess on MAC OS X Lion.
I no longer have a Lion install, but I had a similar problem with Snow Leopard. I'm not sure if the fix for me would also have worked here, but I'm including it in case it helps anyone. Basically you have to add this to you .htaccess after the line saying RewriteEngine On
So if you had to point to localhost/~myusername/first-folder-under-sites, then you would add
and combined with an open httpd.conf set-up (ie not the way it is in my post, but instead less secure as:)
<Directory /> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory>
you should have no problems.