Trouble with Apache in Yosemite

Discussion in 'OS X Yosemite (10.10)' started by RapsacDK, Jun 14, 2014.

  1. RapsacDK macrumors member

    RapsacDK

    Joined:
    Jul 27, 2010
    Location:
    Copenhagen, Denmark
    #1
    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?
     
  2. StevenHoChiMinh macrumors newbie

    Joined:
    Jun 19, 2014
    #2
    Trouble with Apache in Yosemite

    I am also having the same issue! Anyone know the answer it would be much appreciated! :D
     
  3. andijames macrumors member

    Joined:
    Sep 2, 2010
    Location:
    Manchester, UK
    #3
    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
     
  4. RapsacDK thread starter macrumors member

    RapsacDK

    Joined:
    Jul 27, 2010
    Location:
    Copenhagen, Denmark
    #4
    Can anyone post a working copy of httpd.conf?
     
  5. RapsacDK thread starter macrumors member

    RapsacDK

    Joined:
    Jul 27, 2010
    Location:
    Copenhagen, Denmark
    #5
    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.
     
  6. rachalmers macrumors member

    rachalmers

    Joined:
    Oct 21, 2012
    Location:
    UK
    #6
    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.
     
  7. kemo macrumors 6502a

    kemo

    Joined:
    Oct 29, 2008
    Location:
    /Users/kemo
    #7
    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.
     

    Attached Files:

  8. McKheeper macrumors newbie

    Joined:
    Feb 22, 2013
    Location:
    Vancouver BC
    #8
    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.
     
  9. ktwdallas macrumors newbie

    Joined:
    Feb 11, 2005
    #9
    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.
     
  10. realaaa macrumors newbie

    Joined:
    Sep 11, 2010
    #10
    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
     
  11. ohbrilliance macrumors 6502a

    ohbrilliance

    Joined:
    May 15, 2007
    Location:
    Melbourne, Australia
    #11
  12. rachalmers macrumors member

    rachalmers

    Joined:
    Oct 21, 2012
    Location:
    UK
    #12
    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
     
  13. jv2 macrumors newbie

    Joined:
    Apr 9, 2010
    #13
    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....
     
  14. Tantuss macrumors newbie

    Joined:
    Oct 20, 2014
    #14
    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
     
  15. Teal'c macrumors newbie

    Joined:
    Oct 22, 2014
    #15
    Have you checked if your Apache configuration contains any errors?

    You can check the configuration in the command line with:
    Code:
    apachectl -t
     
  16. viniweb macrumors newbie

    Joined:
    Nov 1, 2014
    #17
    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
     
  17. ccmcbeck macrumors newbie

    Joined:
    Nov 8, 2014
    #18
    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/
     
  18. voigtstr macrumors member

    Joined:
    Jan 31, 2008
    Location:
    Hobart, Tasmania, Australia
    #19
    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
    www.voigtstr.com
    versus
    www.voigtstr.com/index.html
    (if they match then I've fixed it! :)
     
  19. voigtstr macrumors member

    Joined:
    Jan 31, 2008
    Location:
    Hobart, Tasmania, Australia
    #20

    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>
     
  20. voigtstr macrumors member

    Joined:
    Jan 31, 2008
    Location:
    Hobart, Tasmania, Australia
    #21
    actually the only bit I was missing was the "Indexes" bit
     
  21. sharon22 macrumors regular

    Joined:
    Oct 19, 2014
    #22
    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?
     
  22. billkenney macrumors newbie

    Joined:
    Jan 5, 2015
    #23
    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!
     

Share This Page