【问题标题】:apache with virtual hosts: 403 forbidden具有虚拟主机的 apache:403 禁止
【发布时间】:2015-08-26 07:44:43
【问题描述】:

我知道,这个问题已经遇到过好几次了,但是看了很多帖子还是不行。有趣的部分:昨天它奏效了。那么,谁能帮我找出错误?一步一步:

我在 Mac OS 10.8.5 上使用 Apache/2.2.29

/etc/hosts

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost

127.0.0.1       scripts
127.0.0.1       page

/private/etc/apache2/httpd.conf

[...]
ServerRoot "/usr"

User _www
Group _www

DocumentRoot "/Users/me/server"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
[...]
<Directory "/Users/me/server">
    MultiViews
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
[...]
Include /private/etc/apache2/extra/httpd-vhosts.conf
[...]

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

<VirtualHost *:80>

        DocumentRoot "/Users/me/server/scripts"
        ServerName scripts
        ErrorLog "/Users/me/server/scripts/errlog"
        CustomLog "/Users/me/server/scripts/customlog" common

</VirtualHost>

<VirtualHost *:80>

        DocumentRoot "/Users/me/server/page"
        ServerName scripts
        ErrorLog "/Users/me/server/page/log/errlog"
        CustomLog "/Users/me/server/page/log/customlog" common

</VirtualHost>

赋予权利:(测试的全部权利)

/Users/me/server
    drwxrwxrwx  5 _www     _www  

/Users/me/server/page 
    drwxrwxrwx  4 _www  _www

重启apache

sudo apachectl restart

我也试过重启浏览器

日志文件 所有的日志文件都是空的

结果

http://localhost
http://page

它们都不起作用,我不断收到禁止的消息。

【问题讨论】:

    标签: macos apache unix


    【解决方案1】:

    您需要在 httpd-vhosts.conf 的第二部分将 ServerNamescripts 更改为 page

    【讨论】:

    • 但我最好删除这篇文章,因为我认为这不是为了共同利益。
    • @AntonHarald 如果你愿意,你可以删除它,但我认为你在这里提供了非常详细的配置,这可能会对一些新手有所帮助。也不会伤害任何人。这是我的看法。
    猜你喜欢
    • 2015-12-30
    • 2013-07-12
    • 2015-08-13
    • 2018-01-03
    • 2019-10-01
    • 1970-01-01
    • 2015-09-16
    • 2011-10-16
    • 2015-09-16
    相关资源
    最近更新 更多