我无法在Apache别名中拒绝权限

时间:2018-08-19 12:14:41

标签: javascript chart.js virtualhost

为什么我不能拒绝Apache别名的权限?

这是我的代码:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName ayandap.com
        ServerAlias www.ayandap.com
        Alias /home /public_html/Login

        <Directory /public_html/Login>
          Order allow,deny
          Allow from all
          Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

1 个答案:

答案 0 :(得分:1)

您的虚拟主机配置不正确。您没有定义文档根目录。请参考下面的示例配置。

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName ayandap.com
    ServerAlias www.ayandap.com
    DocumentRoot /var/www/public_html/Login

    Alias /home /var/www/public_html/Login

    <Directory /var/www/public_html/Login>
      Order allow,deny
      Allow from all
      Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

如果它仍然给您带来错误,请尝试注释掉最后两行,

#ErrorLog ${APACHE_LOG_DIR}/error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined