Windows Apache 2.2 主虚拟主机出现 403

Windows Apache 2.2 主虚拟主机出现 403

好的,我已经为 Apache 2.4 解决了这个问题,Google 上还有其他几个类似的问题,所以我尝试了其他解决方案,但仍然无法将至少主要的 Drupal 工作站点放入其虚拟主机中。因此,第一个分组显示了正在工作的 httpd.conf,其中包含将为虚拟主机更改的部分。由于只有一个其他虚拟主机,我保留了 vhosts 的配置文件,并选择了更简单的方法,将其保存在这个单个 httpd.conf 文件中。

ServerRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2"
Listen 80
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
</Directory>

<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

 I don't know why this was left in as there is no "Drupal" folder in /htdocs. This is left here for completeness but is removed in my broken config file below.

<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/Drupal">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

当然,我必须将“主”站点移至其自己的虚拟主机声明中,并根据需要进行修改。请注意,Windows 中的权限必须正确,因为上述配置适用于此目录。为什么它似乎在其 vhost 块中不起作用?

这是我根据 Apache 文档和上述工作示例尝试实现的功能。主要问题是启动并运行“默认”站点。

ServerRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2"
Listen 80
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
<Directory />
    Order deny,allow
    Deny from all
    Options None
    AllowOverride none
</Directory>
NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
  ServerName myshcool.edu
  <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">
    Options Indexes FollowSymLinks Includes
    AllowOverride All
    Order allow,deny
    #Order deny,allow
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "C:/independent/"
  ServerName bob.myschool.edu
  <Directory "C:/independent/">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

我花了几个小时研究这个问题,尝试了我在 Google 和服务器故障上找到的各种方法。以下是错误日志中的一条代表性消息:

客户端被服务器配置拒绝:C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/

帮我看看我忽略了什么,谢谢,sam

答案1

您可以访问您的“bob.myschool.edu”网站吗?我认为您可能想将 Order 替换为 Order denied,allow。最后一个选项获胜,默认情况下,deny 会拒绝所有选项。请参阅http://docstore.mik.ua/orelly/linux/apache/ch05_06.htmhttp://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow因此,在全局配置中您需要允许拒绝,而在 vhosts 配置中则相反。

相关内容