[英]XAMPP Windows Apache VirtualHost 403 Forbidden
I had XAMPP running fine with virtual hosts on my winodws 8 machine until I was forced to restart my computer (windows update). 我的winodws 8机器上的XAMPP与虚拟主机运行良好,直到我被迫重新启动计算机(Windows更新)。 After restarting I've noticed my virtual hosts weren't working any more. 重新启动后,我注意到我的虚拟主机不再工作了。 Instead of trouble shooting too much I decided to reinstall XAMPP (currently have XAMPP 3.1.0 running. Which is runnign Apache v 2.4.3) 我决定重新安装XAMPP(目前正在运行XAMPP 3.1.0。这是运行Apache v 2.4.3)而不是过多的故障排除
I have my windows host file edited to redirect sitename.localhost
to 127.0.0.1 and this is what I have in my httpd-vhost.conf: 我编辑了我的windows主机文件,将sitename.localhost
重定向到127.0.0.1,这就是我在httpd-vhost.conf中的内容:
NameVirtualHost *
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "C:\Users\USER\Documents\sitename"
ServerName sitename.localhost
<Directory "C:\Users\USER\Documents\sitename">
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Every time I try to access http://sitename.localhost I get a 403 Access Forbidden error. 每次我尝试访问http://sitename.localhost时 ,都会收到403 Access Forbidden错误。 Any idea what I'm doing wrong? 知道我做错了什么吗?
Try adding Require all granted
to the Directory configuration: 尝试添加Require all granted
目录配置:
NameVirtualHost *
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "C:\Users\USER\Documents\sitename"
ServerName sitename.localhost
<Directory "C:\Users\USER\Documents\sitename">
Order deny,allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
Also, try to set reading permissions to the web site folder for Authenticated users . 此外,尝试为经过身份验证的用户设置网站文件夹的读取权限。
This will list out as index. 这将列为索引。
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Users\USER\Documents\sitename"
ServerName projectname.dev
ServerAlias projectname.dev
<Directory "C:\Users\USER\Documents\sitename">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
could you test this code pls instead of yours? 你可以测试这段代码而不是你的吗?
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Users\USER\Documents\sitename"
ServerName sitename.localhost
<Directory "C:\Users\USER\Documents\sitename">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
btw, do you have index.html/php file in folder "C:\\Users\\USER\\Documents\\sitename", don't you? 顺便说一句,你有文件夹“C:\\ Users \\ USER \\ Documents \\ sitename”中的index.html / php文件,不是吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.