After the MAC was upgraded to the latest system, the locally tested site could not run normally. The reason was that after the mac system was upgraded, the version of apache was also upgraded
Server version: Apache/2.4.9 (Unix)
Server built: Sep 9 2014 14:48:20
The version before upgrade is 10.9
<em><strong>Server version: Apache/2.2.26 (Unix) Server built: Dec 10 2013 22:09:38<br><br>基本上之前配置的block都被覆盖了<br>所以导致站点不能正常工作<br>解决办法是<br>1 重新启用php 以避免php的脚本文件直接显示到网页上<br></strong></em>
sudo mvim /etc/apache2/httpd.conf
<span class="s1">打开文件后 回车 输入 <br></span>
/LoadModule php5_module libexec/apache2/libphp5.so
再文件中找到该行 去掉前面的#<br>保存即可<br><br><strong><em>2、开启支持用户级目录 http://localhost/~username/<br><br></em></strong>用户级目录不能访问了
<span style="color: #000000;">Not Found The requested URL /~zhuzi/ was not found on this server.</span>
<em><strong>配置用户级目录的.conf(一般会在用户级的根目录下有一个~/Sites)的目录 该目录就是用户级的站点 <br>没有的话需要重新创建<br>sudo mkdir ~/Sites<br>这时需要配置zhuzi.conf<br></strong></em>
sudo mvim /etc/apache2/users/zhuzi.conf
Add the following code (10.10) configuration method
<Directory "/Users/zhuzi/Sites/"> Options Indexes MultiViews AllowOverride None Require all granted </Directory>
Then change the directory permissions
sudo chmod 775 /etc/apache3/users/zhuzi.conf
You also need to configure httpd.conf
sudo mvim /etc/apache2/httpd.conf
Use vim’s search command to find a few blocks and remove the # in front of them
<span style="color: #000000;">LoadModule authz_core_module libexec/apache2/mod_authz_core.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule userdir_module libexec/apache2/mod_userdir.so Include /private/etc/apache2/extra/httpd-userdir.conf</span>
Configure httpd-userdir.conf
sudo nano /etc/apache2/extra/httpd-userdir.conf
Remove the # before this block
Include /private/etc/apache2/users/*.conf
Restart apache
sudo apachectl restart
You can access it here
http://localhost/~zhuzi/
<em><strong><br><br><br></strong></em>