Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After install OS X El Capitan, Apache not working

I just installed in my MacBook pro "El capitan" and I can't type any host set it in vhost. Everything was working perfectly before in Yosemite. When I type one of my virtualhost I get:

403 "Forbidden You don't have permission to access / on this server."

What did I try ?

go to /etc/apache2/httpd.conf and uncoment this lines:

Include /private/etc/apache2/extra/httpd-vhosts.conf

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

/etc/apache2/extra/httpd-vhosts.conf is the same file that was working before in Yosemite since long time ago, so I haven't modified.

To install everything in Yosemite I used homebrew.

Another problem related with "El capitan", before I was able to type http://localhost/~myuser/ and I could access to any folder in /Users/myuser/Sites now I get this message: 404 not found.

I hope some help, I am not specialist in servers and it's really difficult to me to set it up, and is very annoying to waste a lot of time anytime there is a new upgrade in the OS.

like image 215
davidrg11 Avatar asked Oct 09 '15 21:10

davidrg11


Video Answer


5 Answers

The upgrade process keeps a copy of your old httpd.conf. Unless you were way out of date, just overwrite the new file with your old one. Keep a copy of the new just in case...

sudo cp /etc/apache2/httpd.conf /etc/apache2/httpd.conf.after-update
sudo mv /etc/apache2/httpd.conf.pre-update /etc/apache2/httpd.conf
sudo apachectl restart
like image 181
DSG Avatar answered Oct 18 '22 22:10

DSG


I had the same trouble. Type this command line you will have the error from apache :

apachectl configtest

If you have this error :

AH00526: Syntax error on line 20 of /private/etc/apache2/extra/httpd-mpm.conf: Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration.

so this link can help : https://apple.stackexchange.com/questions/211015/el-capitan-apache-error-message-ah00526

like image 23
jerems Avatar answered Oct 18 '22 22:10

jerems


I experienced that after the upgrade to El Capitan the line

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

in

/private/etc/apache2/httpd.conf

was commented again. After uncommenting it and restarting apache, everything worked alright again.

like image 11
janwo Avatar answered Oct 18 '22 22:10

janwo


I have merged to two versions (httpd.conf and http.conf~previous) and after that I discovered that the v-host wasn't working anymore. After disabling rule 19 #NameVirtualHost *:80 in /private/etc/apache2/extra/httpd-vhosts.conf everything worked again!

like image 3
Jaap van Duijn Avatar answered Oct 18 '22 22:10

Jaap van Duijn


LockFile is a directive of Apache ≤ 2.2. El Capitan comes with Apache version 2.4. so, you need to disable LockFile

First, just to be sure apache is stopped:

sudo apachectl stop

Then edit your httpd-mpm.conf:

Comment this lines

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
  LockFile "/private/var/log/apache2/accept.lock"
</IfModule>
</IfModule>

Start apache sudo apachectl start and that's all

like image 2
PolloZen Avatar answered Oct 18 '22 22:10

PolloZen