当我试图在vhost下打开一个页面时,我得到了一个403访问被禁止,其中文档根目录与apache所在的驱动器不同。我是使用apachefriends发行版安装的。这是我的httpd-vhosts.conf文件:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName foo.localhost
DocumentRoot "C:/xampp/htdocs/foo/public"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName bar.localhost
DocumentRoot "F:/bar/public"
</VirtualHost>
When opening bar.localhost in my browser, Apache is giving me 403 Access Forbidden. I tried setting lots of different access rights, even full rights to everyone, but nothing I tried helped.
Edit: Thanks! For future reference, add 'Options indexes' within to show directory indexes.
发布于 2012-09-22 23:41:01
你不需要
Options Indexes FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
你唯一需要的是..。
Require all granted
对目录部分执行...inside操作。
请参阅Apache 2.4升级方面:
发布于 2008-09-18 12:00:29
在某个地方,您需要告诉Apache允许用户查看此目录的内容。
<Directory "F:/bar/public">
Order Allow,Deny
Allow from All
# Any other directory-specific stuff
</Directory>
发布于 2020-01-25 00:16:23
已解决403:访问localhost时禁用。使用端口80,443,3308 (后者用于处理与MySQL服务器安装的冲突)Windows10,XAMP7.4.1,Apache2.4.x我的web文件都在一个单独的文件夹中。
httpd.conf -查找这些行,并将其设置在您的文件所在的位置,我的是web文件夹。
DocumentRoot "C:/web"
<Directory "C:/web">
更改了这两行。
<VirtualHost *:80>
ServerAdmin webmaster@localhost.com
DocumentRoot "C:/web/project1"
ServerName project1.localhost
<Directory "C:/web/project1">
Order allow,deny
allow from all
</Directory>
</VirtualHost>
到这个
<VirtualHost *:80>
ServerAdmin webmaster@localhost.com
DocumentRoot "C:/web/project1"
ServerName project1.localhost
<Directory "C:/web/project1">
Require all granted
</Directory>
</VirtualHost>
将详细信息添加到主机文件C:\Windows\System32\drivers\etc\hosts文件中
127.0.0.1 localhost
127.0.0.1 project1.localhost
停止启动XAMPP,然后单击Apache admin (或localhost),现在将显示精彩的XAMPP仪表板!并访问您的项目project1.localhost
https://stackoverflow.com/questions/89118
复制相似问题