Apple MacBook搭建Apache多站点

用Apple MacBook搭建了LAMP环境,但是当使用多站点时出现了问题:you don't have permission to access / on this server。查阅了资料有的说是deny的问题,有的说是的selinux 的事,改了都没用。看来还是需要自己找答案。

我的Apache版本是2.4下面把正确的配置方式贴出来供以后参考。注意红色文字。

sudo vi /etc/apache2/httpd.conf

查找Require all denied在这句话前面追加#

追加这句话在Include /private/etc/apache2/extra/httpd-vhosts.conf之前。
NameVirtualHost *:80

查找以下语句,去掉前面的#

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

最后,修改httpd-vhosts.conf文件。

sudo vi /etc/apache2/extra/httpd-vhosts.conf

内容如下:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName localhost
        DocumentRoot /Library/WebServer/Documents
        <Directory /Library/WebServer/Documents>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
        </Directory>
</VirtualHost>


<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName resume_parse_manager.test.com
        DocumentRoot /Users/niuyufu/Zend/workspaces/resume_parse_manager/Public
        <Directory /Users/niuyufu/Zend/workspaces/resume_parse_manager>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
        </Directory>
</VirtualHost>

Apache 的详细介绍请点这里
Apache 的下载地址请点这里

猜你喜欢

转载自www.linuxidc.com/Linux/2015-07/119599.htm