使用 XAMPP,错误 403 访问被禁止

使用 XAMPP,错误 403 访问被禁止

更新(找到了可行的解决方案): http://maff.ailoo.net/2008/07/set-up-multiple-virtual-hosts-on-xampp-for-windows/

 <VirtualHost *:80>
 ServerAdmin webmaster@localhost
 DocumentRoot D:/srv/xampp/projects/testproject/public
 ServerName testproject

 <Directory "D:/srv/xampp/projects/testproject/public">
  Options Indexes FollowSymLinks Includes ExecCGI
  AllowOverride All
  Order allow,deny
  Allow from all
 </Directory>
</VirtualHost>

我尝试过重新安装,但没有成功。我使用的是 XAMPP 1.7.3,Windows 7 64 位。

遵循以下指示:尝试在 Apache 上查看本地主机时出现 403 禁止错误

[Sat Oct 16 16:09:54 2010] [notice] Digest: generating secret for digest authentication ...
[Sat Oct 16 16:09:54 2010] [notice] Digest: done
[Sat Oct 16 16:09:54 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Sat Oct 16 16:09:54 2010] [notice] Server built: Nov 11 2009 14:29:03
[Sat Oct 16 16:09:54 2010] [notice] Parent: Created child process 4960
[Sat Oct 16 16:09:58 2010] [notice] Digest: generating secret for digest authentication ...
[Sat Oct 16 16:09:58 2010] [notice] Digest: done
[Sat Oct 16 16:09:59 2010] [notice] Child 4960: Child process is running
[Sat Oct 16 16:09:59 2010] [notice] Child 4960: Acquired the start mutex.
[Sat Oct 16 16:09:59 2010] [notice] Child 4960: Starting 150 worker threads.
[Sat Oct 16 16:09:59 2010] [notice] Child 4960: Starting thread to listen on port 443.
[Sat Oct 16 16:09:59 2010] [notice] Child 4960: Starting thread to listen on port 80.
[Sat Oct 16 16:09:59 2010] [notice] Child 4960: Starting thread to listen on port 443.
[Sat Oct 16 16:09:59 2010] [notice] Child 4960: Starting thread to listen on port 80.
[Sat Oct 16 16:10:30 2010] [error] [client 127.0.0.1] client denied by server configuration: C:/projects/test/
[Sat Oct 16 16:10:36 2010] [error] [client 127.0.0.1] client denied by server configuration: C:/projects/test/favicon.ico

虚拟主机文件:

NameVirtualHost *:80
<VirtualHost *:80>
    ##ServerAdmin [email protected]
    DocumentRoot "C:/projects/test"
    ServerName test
    ##ServerAlias www.dummy-host2.localhost
    ##ErrorLog "logs/dummy-host2.localhost-error.log"
    ##CustomLog "logs/dummy-host2.localhost-access.log" combined
</VirtualHost>

主办方:

# Virtual host
127.0.0.1    test

答案1

(找到了一个可行的解决方案): http://maff.ailoo.net/2008/07/set-up-multiple-virtual-hosts-on-xampp-for-windows/

 <VirtualHost *:80>
 ServerAdmin webmaster@localhost
 DocumentRoot D:/srv/xampp/projects/testproject/public
 ServerName testproject

 <Directory "D:/srv/xampp/projects/testproject/public">
  Options Indexes FollowSymLinks Includes ExecCGI
  AllowOverride All
  Order allow,deny
  Allow from all
 </Directory>
</VirtualHost>

答案2

这对 Ubuntu 11.10 和版本 1.7.7 有效,在 httpd.conf 中,我在目录中添加了 # 以使其与 vhosts 配合使用。我的 vhosts 位于根文件夹之外...

并将用户和组从 nobody 更改为您的用户名:

User nobody
Group nobody
</IfModule>
</IfModule>

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
# Options FollowSymLinks
# AllowOverride None
# Order deny,allow
# Deny from all
</Directory>

答案3

在 apache 文件夹中,转到extra并打开文件httpd-xamp.conf

编辑以下行:

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/8 
    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>

更改上述配置如下:

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from all
    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>

现在重新启动 XAMPP,它就可以工作了。

答案4

就我而言,我已经有了适当的设置。

解决方案:重新创建文件httpd-xamp.conf

它位于 apache 文件夹中:extrasubdir。

相关内容