OS X 配置 Apache

1.去掉javascript:void(0);Include /private/etc/apache2/extra/httpd-vhosts.con的注释,以启用虚拟主机;

2.在<Directory "/Library/WebServer/CGI-Executables">...</Directory>后做如下配置:

 1 < Directory "/Library/WebServer/CGI-Executables" >
 2   AllowOverride None
 3   Options None
 4   Require all granted
 5 </Directory>
 6 < Directory "/Users/Shared/cFrost.net" >
 7   Options FollowSymLinks Multiviews
 8   MultiviewsMatch Any
 9   AllowOverride None
10   Require all granted
11 </Directory>

3.在/etc/apache2/extra/httpd-vhosts.conf注释掉如下部分:

<VirtualHost *:80>
  ServerAdmin webmaster@dummy-host.example.com
  DocumentRoot "/usr/docs/dummy-host.example.com"
  ServerName dummy-host.example.com
  ServerAlias www.dummy-host.example.com
  ErrorLog "/private/var/log/apache2/dummy-host.example.com-    error_log"
  CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
  ServerAdmin webmaster@dummy-host2.example.com
  DocumentRoot "/usr/docs/dummy-host2.example.com"
  ServerName dummy-host2.example.com
  ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
  CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
</VirtualHost>

4.然后增加如下配置:

<VirtualHost *:80>
  DocumentRoot "/Library/WebServer/Documents"
  ServerName localhost
  ErrorLog "/private/var/log/apache2/localhost-error_log"
  CustomLog "/private/var/log/apache2/localhost-access_log" common
</VirtualHost>
<VirtualHost *:80>
  DocumentRoot "/Users/Shared/cFrost.net"
  ServerName cfrost.net.local
  ErrorLog "/private/var/log/apache2/sites-error_log"
  CustomLog "/private/var/log/apache2/sites-access_log" common
</VirtualHost>

5.sudo apachectl restart重启Apache即可,注意站点目录755权限,测试不能放在用户目录。

posted @ 2015-11-11 16:35  cFrost  阅读(221)  评论(0编辑  收藏  举报