403禁止 - 许可 - VHOSTS

时间:2016-06-23 10:29:59

标签: apache virtual host http-status-code-403 vhosts

我无法访问我的虚拟主机(只有默认的主机,本地主机)。它让我:

  

禁止

     

您无权访问此服务器上的内容。

我已经在我的httpd.conf中加载了模块,我在apache 2.4上,我已经检查了所有权限文件夹(chmod 755)。

我的httpd-vhosts.conf文件:

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
Listen 80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Library/WebServer/Documents"
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/Users/POlo/Sites/polohome"
    ServerName polohome
    # Set access permission
    <Directory "/Users/POlo/Sites/polohome">
    DirectoryIndex index.html index.php
    Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
        DocumentRoot "/Users/POlo/Sites/aeglos"
        ServerName aeglos
        ErrorLog "/private/var/log/apache2/aeglos.local-error_log"
        CustomLog "/private/var/log/apache2/aeglos.local-access_log" common

        <Directory "/Users/POlo/Sites/aeglos/">
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

我唯一发现的是在更改httpd.conf文件中的DirectoryIndex时,它会在不执行它的情况下呈现我的php行。并且在httpd-vhosts.conf文件中添加directoryIndex什么也没做。

感谢您的帮助。

更新:不明白为什么......但是当它切换到PHP 5.6时它正在工作,在php 7.0.6上仍然会让我看到403禁止页面。

1 个答案:

答案 0 :(得分:0)

(代表OP发布)

升级我的mac后,我的php切换器无法工作,因为phpd_module没有在httpd.conf中调用。