Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RapsacDK

macrumors member
Original poster
Jul 27, 2010
46
0
Copenhagen, Denmark
I had a perfectly working setup of Apache on my Mavericks installation, which seems to have been corrupted when installing Yosemite? Apache IS installed, but playing around with Directories in httpd.conf, I either get an Error 403 or unable to connect, when trying to reach http://localhost/

Any ideas?
 

StevenHoChiMinh

macrumors newbie
Jun 19, 2014
1
0
Trouble with Apache in Yosemite

I am also having the same issue! Anyone know the answer it would be much appreciated! :D
 

andijames

macrumors member
Sep 2, 2010
59
0
Manchester, UK
Don't forget Apache has been upgraded to 2.4 (From 2.2) and a LOT of the directives have changed. Check your log file in '/var/log/apache2/error_log' to see what it's complaining about but i really wouldn't try using old config files on this as there is a LOT of difference.

Edit: If it keeps saying 'Forbidden' then it's to do with user permissions. Make sure the user directory extra is included and maybe change the user/group that apache runs to 'yourusername'/staff
 

RapsacDK

macrumors member
Original poster
Jul 27, 2010
46
0
Copenhagen, Denmark
I found that the error was not assigning a desired port in my request. installed MAMP and set the access port to 80, which now works perfectly.
 

rachalmers

macrumors member
Oct 21, 2012
61
5
UK
Don't forget Apache has been upgraded to 2.4 (From 2.2) and a LOT of the directives have changed. Check your log file in '/var/log/apache2/error_log' to see what it's complaining about but i really wouldn't try using old config files on this as there is a LOT of difference.

Edit: If it keeps saying 'Forbidden' then it's to do with user permissions. Make sure the user directory extra is included and maybe change the user/group that apache runs to 'yourusername'/staff

I found just now that the new installation makes a new httpd.conf for you. All you need do is set your DocumentRoot and DocumentDirectory, and set your User and Group to what ever the user/group is that owns the directory and files of your site. In my case it was me. as in robert/staff
I unchecked the mod for vhosts, added the php support at the end of the file, saved it, and it came up straight away. Now I just need to fix mysql .... groan.
 

kemo

macrumors 6502a
Oct 29, 2008
821
201
Default httpd.conf included below just in case. :)

It actually solved my problem as older http.conf (from Apache 2.2) was linking to files which are not available/used in the newer Apache 2.4.9 which currently is running on Yosemite.
 

Attachments

  • httpd.conf.txt
    20.3 KB · Views: 3,745

McKheeper

macrumors newbie
Feb 22, 2013
2
0
Vancouver BC
Here is Solution

Well I have fight with the new apache configuration too. After putting the new apache configuration in debug mode and set the apache as usually for me was setting the virtual hosts on local device. I have got strange error output that I have never seen before:

Code:
[Fri Jul 25 15:40:22.551907 2014] [authz_core:debug] [pid 20473] mod_authz_core.c(799): [client ::1:51682] AH01626: authorization result of Require all denied: denied
[Fri Jul 25 15:40:22.552054 2014] [authz_core:debug] [pid 20473] mod_authz_core.c(799): [client ::1:51682] AH01626: authorization result of <RequireAny>: denied
[Fri Jul 25 15:40:22.552061 2014] [authz_core:error] [pid 20473] [client ::1:51682] AH01630: client denied by server configuration: /Users/lukas/Sites/somesite/

So I have look at the configuration form top to bottom and find this:
Code:
# 
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
# 
<Directory />
    AllowOverride none
    Require all denied
</Directory>

After commenting the line Require all denied
Code:
# 
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
# 
<Directory />
    AllowOverride none
    #Require all denied
</Directory>

restarting the apache everything works just fine. You may need to uncomment some modules but please be careful because some modules aren't completed or so and cause error.
 

ktwdallas

macrumors newbie
Feb 11, 2005
3
0
I haven't been able to get apache running since Yosemite beta and I don't have any error logs from apache at all. (Verified /var/log/apache2 exists and is 777 writeable).

My regular system log shows

2014-09-01 21:06:07.413 com.apple.xpc.launchd[1]: (org.apache.httpd) Please switch away from OnDemand to KeepAlive.
2014-09-01 21:06:07.510 com.apple.xpc.launchd[1]: (org.apache.httpd[1435]) Service exited with abnormal code: 1
2014-09-01 21:06:07.510 com.apple.xpc.launchd[1]: (org.apache.httpd) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.


can't find any info on what this is or where this is set.
 

realaaa

macrumors newbie
Sep 11, 2010
9
0
had the same issue, trying to start Apache from command line resulted in this:

Code:
$ ./startApache.sh
dyld: Symbol not found: _iconv
  Referenced from: /usr/lib/libmecabra.dylib
  Expected in: /Applications/MAMP/Library/lib/libiconv.2.dylib
 in /usr/lib/libmecabra.dylib
/Applications/MAMP/Library/bin/apachectl: line 80:  7103 Trace/BPT trap: 5       $HTTPD -k $ARGV

see here for possible solution, need to rename envvars to _envvars (no idea why but it helped, didn't investigate further):

http://stackoverflow.com/questions/25201280/apache-not-starting-on-mamp-pro
 

rachalmers

macrumors member
Oct 21, 2012
61
5
UK
I had a perfectly working setup of Apache on my Mavericks installation, which seems to have been corrupted when installing Yosemite? Apache IS installed, but playing around with Directories in httpd.conf, I either get an Error 403 or unable to connect, when trying to reach http://localhost/

Any ideas?

I had that 403 on my main Vhosts directory. chalmers.com.au
Once I added index.php (see below) it worked. I had also a .htaccess file in that ghost directory, that disallowed Indexes, so as it couldn't do either - and there was no index.html file the default, it gave me an error 403.


What a pain this is ... :)

I have everything working now in the latest 10.10 release. As at 30th September 2014.

I had a perfect working Apache running on 10.9, finally bit the bullet today one up'd to 10.10. Of course Apache broke.

Made sure I had things ok in http.conf, with a few changes.

Had to add this, index.php - I'd completely forgotten it.


# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

I turned off Indexes by removing it from here
Options FollowSymLinks Multiviews Indexes
MultiviewsMatch Any

I changed my User/Group to _www/staff, because I'm using Wordpress and it needs to be that so it will store files in the directory.

There were a few changes for the virtual hosts, but not many. Had to tweek my .htaccess files as well

I guess there will be other things - but for now, I'm happy
 

jv2

macrumors newbie
Apr 9, 2010
18
7
Really? Every Freaking update?!

c'mon Apple do you really have to break apache with every single major update? It's not like we don't spend hours setting up things just the way we want.

Make a backup of our current httpd.conf file before overwriting it? Noooooo.... that would be too easy.....

Love Yosemite... hate losing hours to something stupidly preventable like this....
 

Tantuss

macrumors newbie
Oct 20, 2014
1
0
Make sure that any previously included extra config files are still included, and then test the configuration with the command:

sudo apachectl configtest


If you are using virtual hosts you will probably need to change your configuration files somewhat. In particular you will need to change the following:

2.2 configuration:
Order allow,deny
Allow from all

2.4 configuration:
Require all granted
 

Teal'c

macrumors newbie
Oct 22, 2014
1
0
I haven't been able to get apache running since Yosemite beta and I don't have any error logs from apache at all. (Verified /var/log/apache2 exists and is 777 writeable).

My regular system log shows

2014-09-01 21:06:07.413 com.apple.xpc.launchd[1]: (org.apache.httpd) Please switch away from OnDemand to KeepAlive.
2014-09-01 21:06:07.510 com.apple.xpc.launchd[1]: (org.apache.httpd[1435]) Service exited with abnormal code: 1
2014-09-01 21:06:07.510 com.apple.xpc.launchd[1]: (org.apache.httpd) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.


can't find any info on what this is or where this is set.

Have you checked if your Apache configuration contains any errors?

You can check the configuration in the command line with:
Code:
apachectl -t
 

viniweb

macrumors newbie
Nov 1, 2014
1
0
c'mon Apple do you really have to break apache with every single major update? It's not like we don't spend hours setting up things just the way we want.

Make a backup of our current httpd.conf file before overwriting it? Noooooo.... that would be too easy.....

Love Yosemite... hate losing hours to something stupidly preventable like this....

The config file is backed up at /etc/apache2/httpd.conf~previous

Source: http://faisalzqureshi.blogspot.com.br/2014/10/apache-stops-working-after-installing.html
 

ccmcbeck

macrumors newbie
Nov 8, 2014
1
0
No sure why everyone has to shoot the messenger (Apple). Sigh.

Apache (not Apple) changed the syntax of their CONF files between Mavericks (Apache 2.2) and Yosemite (Apache 2.4). The essentials are documented by Apache here:

http://httpd.apache.org/docs/current/upgrading.html

I think most of us get tripped up by the change in access control from

Code:
Order allow,deny
Allow from all

to

Code:
Require all denied  # or granted

In my case, I leave the global deny as is

Code:
<Directory />
    AllowOverride none
    Require all denied
</Directory>

But (in a separate file in other/customize.conf) I allow access to my ~/Sites
Code:
<Directory "/Users/me/Sites">
  Require all granted
</Directory>

Another useful guide is this:

http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/
 

voigtstr

macrumors member
Jan 31, 2008
88
1
Hobart, Tasmania, Australia
I've got a weird issue with Apache on Yosemite as well.

if I put in my server's address I get one page (which is an old page)
if I put in server address /index.html or index.html.en (they both have the same contents) I get a different page

which line defines the default html page served if the user only specifies the server?

test it yourself at
http://www.voigtstr.com
versus
http://www.voigtstr.com/index.html
(if they match then I've fixed it! :)
 

voigtstr

macrumors member
Jan 31, 2008
88
1
Hobart, Tasmania, Australia
I've got a weird issue with Apache on Yosemite as well.

if I put in my server's address I get one page (which is an old page)
if I put in server address /index.html or index.html.en (they both have the same contents) I get a different page

which line defines the default html page served if the user only specifies the server?

test it yourself at
http://www.voigtstr.com
versus
http://www.voigtstr.com/index.html
(if they match then I've fixed it! :)


fixed!

DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
Options FollowSymLinks Multiviews
MultiviewsMatch Any


AllowOverride None

Require all granted
</Directory>

To:
DocumentRoot "/Users/myusername/Sites"
<Directory "/Users/myusername/Sites">
Options Indexes FollowSymLinks Multiviews
MultiviewsMatch Any

AllowOverride None

Require all granted

</Directory>
 

voigtstr

macrumors member
Jan 31, 2008
88
1
Hobart, Tasmania, Australia
fixed!

DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
Options FollowSymLinks Multiviews
MultiviewsMatch Any


AllowOverride None

Require all granted
</Directory>

To:
DocumentRoot "/Users/myusername/Sites"
<Directory "/Users/myusername/Sites">
Options Indexes FollowSymLinks Multiviews
MultiviewsMatch Any

AllowOverride None

Require all granted

</Directory>

actually the only bit I was missing was the "Indexes" bit
 

sharon22

macrumors regular
Oct 19, 2014
194
0
MY problem was that somehow, I "lost" my Apache2 log directory!

It was very difficult to diagnose (I became Google's best customer for one entire day LOL).

I discovered that Apache was generating error messages.

Why was it generating error messages? Because: the log file that Apache wanted to write it's own error messages to was missing.

So by merely creating the error log directory, there were no longer any errors, and I was able to access "localhost!"

BTW, my apache error log directory is here:
Hard Drive / private / var / log / apache2

Before, it was just "Hard Drive / private / var / log /"

So I created the apache2 directory (in terminal, typed "mkdir apache2") and made sure the permissions were drwxr-xr-x

Does that help you?
 

billkenney

macrumors newbie
Jan 5, 2015
2
0
After attempting to fix this problem for 6 hours I was finally able to get this to work. I edited the httpd.conf, httpd-userdir.conf, httpd-vhosts.conf, etc to no avail. Leaving all of these files unedited from the yosemite configuration, what finally worked for me was to edit the httpd_server_app.conf located at /Library/Server/Web/Config/apache2/ by adding the following (for each site) as follows:

Code:
<Directory />
    Options +FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "/Library/Server/Web/Data/Sites/Default/">
    Options +Indexes +FollowSymLinks +MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<Directory "/Library/Server/Web/Data/Sites/[OTHER SITE DIRECTORY]/">
    Options +Indexes +FollowSymLinks +MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Make sure if you use textedit to edit this file you undo the automatic insertion of the slanted quotation marks otherwise you will get a unicode error message.

Hope this helps!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.