You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Yosemite has broken my apache localhost connection to Sites

I'm having the following problem when i try to access my projects on localhost from the Sites dir

Not Found

The requested localhost/~myusername/ was not found on this server.

I know apache is working because I get a response from localhost [It Works!]

and I can curl it with headers using [curl --head localhost] and I get a 200 but when I try to use the projects in my sites folder I get the above error.

I have amended the httpd.conf file and the user/username.conf file to point to the correct dir.

Is it possible that there is there a different format for the localhost path on yosemite os ?

iMac, OS X Yosemite (10.10), Apache 2.4.9

Posted on Oct 28, 2014 2:20 PM

Reply
10 replies
Sort By: 

Oct 29, 2014 1:44 PM in response to chiefwhip

I am having a similar problem but instead I am getting this error and apache isn't running at all. "httpd: Syntax error on line 59 of /private/etc/apache2/httpd.conf: Cannot load libexec/apache2/mod_authn_default.so into server: dlopen(/usr/libexec/apache2/mod_authn_default.so, 10): image not found" My virtual hosts were working fine until the Yosemite update

Reply

Jan 17, 2015 6:49 PM in response to Matt_Sanford

I'm having the same problem with User Sites and sub-directories in Webserver Documents. Attempting to access a sub-directory gives me a 403 forbidden error and http://localhost/~username/ gives me URL not found on this server. I've worked the permissions and setup the recommended modules to no avail. The phpMyAdmin sub-directory works out of Webserver Documents. Why does it work and mine doesn't? It does have a config_inc.php file pointing at the server with the MySQL userID and password.


There's this directive in the httpd.conf file:


#

# Apple specific filesystem protection.

#

<Files "rsrc">

Require all denied

</Files>

<DirectoryMatch ".*\.\.namedfork">

Require all denied

</DirectoryMatch>


I'm assuming it's protecting the system level file directory. Could it be interfering with Apache?


Any and all help would be greatly appreciated.

Reply

Jan 17, 2015 7:28 PM in response to barneyfrommount dora

barneyfrommount dora wrote:


I'm having the same problem with User Sites and sub-directories in Webserver Documents. Attempting to access a sub-directory gives me a 403 forbidden error and http://localhost/~username/ gives me URL not found on this server. I've worked the permissions and setup the recommended modules to no avail. The phpMyAdmin sub-directory works out of Webserver Documents. Why does it work and mine doesn't? It does have a config_inc.php file pointing at the server with the MySQL userID and password.


There's this directive in the httpd.conf file:


#

# Apple specific filesystem protection.

#

<Files "rsrc">

Require all denied

</Files>

<DirectoryMatch ".*\.\.namedfork">

Require all denied

</DirectoryMatch>


I'm assuming it's protecting the system level file directory. Could it be interfering with Apache?


Any and all help would be greatly appreciated.

It is, and it is not interfering with Apache.


You need to check both he http.conf file and the username.conf file in /etc/apache2

You need to uncomment this line in http.conf (remove the # symbol)

#Include /private/etc/apache2/extra/httpd-userdir.conf


In the /etc/apache2/exrtra/httpd-userdir.conf, uncomment:

#Include /private/etc/apache2/users/*.conf


Then, in each username.con in /etc/apache2/users, it should look like:

<Directory "/Users/Barney/Sites/">

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

</Directory>


Note, you must change your <Directory/> tag to your actual usename between /Users/ and /Sites/

Reply

Jan 18, 2015 7:07 AM in response to Barney-15E

I had already done most of what was recommended. The only difference was in the Users/~name/Sites.conf where I had used:


AllowOverride None

Options Indexes MultiViews FollowSymLinks

Require all granted


I changed this to what was recommended and received the same results.


I tried going into the httpd.conf and amending the blanket <Directory /> to Require all granted.


Does Apple want us to have a localhost test bed? From the posts, these problems seem to have started with Yosemite.


Never had these problems in Windows and I dislike Windows after using OSX for a couple of years.


What next?

Reply

Jan 18, 2015 7:35 AM in response to Barney-15E

Yosemite uses Apache 2.4, so the user.conf file needs to be:

<Directory "/Users/Barney/Sites/">

Options Indexes MultiViews

AllowOverride None

Require all granted

</Directory>


You may find some tips on configuring you Apache server for development here: http://mallinson.ca/osx-web-development/


Also look in the comments. There is a link to a PrefPane to enable or disable the web server if you don't want to bother with Terminal.

Reply

Jan 18, 2015 1:05 PM in response to Barney-15E

The web sharing aspect of the Sharing preferences panel has been gone for some time. In Mavericks or Yosemite, there is no other preference panel for managing web service, unless one goes to a third party solution — as in this link to VirtualHostX. There is a free trial. I am still using the free Web Sharing preferences panel from this site on Mavericks, but it no longer appears to be available.

Reply

Jan 22, 2015 1:57 PM in response to barneyfrommount dora

I must add one more thing. The DirectoryIndex in httpd.conf is only setup for index.html.


If you want to cover the bases, it should look like this:


DirectoryIndex index.html index.htm index.php


Of course, you may add others like default.~ and others.


If you have TextWrangler, you may edit httpd.conf by clicking the show hidden files on the file open panel. I find it a lot quicker than vi or nano. You still have to unlock and authenticate.

Reply

Yosemite has broken my apache localhost connection to Sites

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.