mac 升级后 web 服务器起不来 问题

时间:2023-03-08 17:52:57

4. Apache

要本地调试代码的时候发现Apache也不能幸免地跪了。执行apachectl -v发现Apache已经更新到2.4.9版本了。一定又是因为版本更新出了什么差错。

4.1 修改httpd.conf

首先打开/private/etc/apache2/httpd.conf发现似乎恢复默认的设置了。重新将以下两行代码解注:

Include /private/etc/apache2/extra/httpd-vhosts.conf
...
LoadModule php5_module libexec/apache2/libphp5.so

4.2 修改httpd-vhosts.conf

打开private/etc/apache2/extra/httpd-vhosts.conf发现之前设好的虚拟主机似乎没有被修改掉嘛!但因为升级到Apache 2.4以上设置需要一定的调整,不然就会得到403 Forbidden You don't have permission to access / on this server错误啦。

将原本的

<VirtualHost *:80>
ServerAdmin zry656565@gmail.com
DocumentRoot "/Users/Jerry/Dev/apache/php_tester"
ServerName php_tester
ErrorLog "/Users/Jerry/Dev/apache/php_tester/log/sites-error_log"
CustomLog "/Users/Jerry/Dev/apache/php_tester/log/sites-access_log" common
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

改成

<VirtualHost *:80>
ServerAdmin zry656565@gmail.com
DocumentRoot "/Users/Jerry/Dev/apache/php_tester"
ServerName php_tester
ErrorLog "/Users/Jerry/Dev/apache/php_tester/log/sites-error_log"
CustomLog "/Users/Jerry/Dev/apache/php_tester/log/sites-access_log" common
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>
</VirtualHost>

其实就是将Order deny,allow, Allow from all改成Require all granted。=====》改了就OK了。

参考:发生在升级OS X Yosemite后:修复各种开发环境