【问题标题】:Apache 403 error forbidden localhostApache 403 错误禁止本地主机
【发布时间】:2015-05-24 19:19:15
【问题描述】:

我只是想设置 localhost,让它指向我机器上的这个目录:

/home/mdobrenko/Sites

我创建了一个新的 conf 文件 (app.conf)

<VirtualHost *:80>
    ServerAlias 192.168.1.66
    ServerName localhost.dev
DocumentRoot /home/mdobrenko/Sites
<Directory /home/mdobrenko/Sites>
    # Don't show directory index
    Options -Indexes +FollowSymLinks +MultiViews

    # Allow .htaccess files
    AllowOverride All

    # Allow web access to this directory
    Require all granted
</Directory>

# Error and access logs
ErrorLog ${APACHE_LOG_DIR}/my-site.error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/my-site.access.log combined

当我尝试访问 localhost.dev 时,出现以下错误:

Forbidden

You don't have permission to access / on this server.

不过,我可以正常访问本地主机。

我是 Linux 和 Web 管理的新手 - 感谢任何帮助,我确信这是我在某个地方犯的一个愚蠢的错误......

【问题讨论】:

    标签: apache ubuntu-14.04


    【解决方案1】:
        <Directory /home/mdobrenko/Sites>
    # Don't show directory index
        Options -Indexes +FollowSymLinks +MultiViews
    
        # Allow .htaccess files
        AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    

    【讨论】:

    • 似乎我仍然遇到同样的错误——还有其他想法吗?
    • 是的 -- sudo service apache2 restart
    • 虽然这个答案可能是正确且有用的,但最好在其中附上一些解释来解释它如何帮助解决问题。如果有更改(可能不相关)导致它停止工作并且用户需要了解它曾经是如何工作的,这在未来变得特别有用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-19
    • 2012-09-30
    • 1970-01-01
    • 2020-05-14
    • 1970-01-01
    • 2021-01-20
    • 2013-05-30
    相关资源
    最近更新 更多