Apache giving 404 error after Mac OS sierra update

别说谁变了你拦得住时间么 提交于 2019-11-30 06:28:41

What worked for me after upgrading from El Capitan to Sierra as well:

1) Uncommenting from /etc/apache2/httpd.conf

LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
Include /private/etc/apache2/extra/httpd-vhosts.conf
Include /private/etc/apache2/extra/httpd-userdir.conf

2) Uncomment from /etc/apache2/extra/httpd-userdir.conf

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

3) In my /etc/apache2/users/$USERNAME.conf file I had ProxyPass configured as well, and to get it working again I had to re-uncomment the following from my httpd.conf

LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so

4) Optional for PHP: You need to re-uncomment the following from the httpd.conf as well:

LoadModule php5_module libexec/apache2/libphp5.so

5) Of course, restart apache

sudo apachectl -k restart

Things worked for me afterwards, however I am better motivated now to start moving to Vagrant.

In Terminal, head to /etc/apache2 and

sudo mv httpd.conf httpd.conf.sierra
sudo mv httpd.conf~previous httpd.conf
sudo apachectl restart

Worked like a charm for me.

cd /etc/apache2
sudo mv httpd.conf httpd.conf.sierra
sudo mv httpd.conf~previous httpd.conf

cd /etc/apache2/extra
sudo mv httpd-vhosts.conf httpd-vhosts.conf.sierra
sudo mv httpd-vhosts.conf~previous httpd-vhosts.conf

sudo apachectl restart

I also updated my El Capitan to Sierra recently and had similar issue. I checked the /etc/apache2/ and extra directory, what I've notices was all the Apache config files were created at the time of update and they looked default but there were also my custom files from el capitan with ~previous in name. All I had to do was to replace those default for those previous and worked like a charm.

in /etc/apache2/extra

you will see a httpd-vhosts.conf~previous

that is your previous vhosts.conf file.

just use the config file on it.

Works like a charm to me.

In case anyone else comes across this and had problems accessing your vhosts after following the chosen answer there was one extra step I had to take.

Inside /private/etc/apache2/extra/httpd-vhosts.conf they had removed the line (in my case it was meant to be right at the bottom of the file):

Include /private/etc/apache2/vhosts/*.vhost

And then

sudo apachectl restart
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!