我收到此错误:您无权访问此服务器上的/。
在apache webserver中启用了vhost插件,在vhost中我有这个:
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/myfiles"
ServerName domain.com
ServerAlias domain.com
ErrorLog "logs/domain.com.log"
CustomLog "logs/domain.com" common
</VirtualHost>
在我的笔记本电脑上工作,而不是在运行windows7的tmp服务器上
答案 0 :(得分:4)
首先,当您设置vhost时,最好也为localhost创建一个。
此外,您需要告诉apache允许哪些IP地址接受来自每个虚拟主机的连接。
所以试试这个
# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC and the local network
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
ServerAdmin webmaster@homemail.net
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
<IfDefine APACHE24>
Require local
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.0 localhost ::1
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/myfiles"
ServerName domain.com
ServerAlias domain.com
ErrorLog "logs/domain.com.log"
CustomLog "logs/domain.com" common
<Directory "C:/wamp/www/myfiles">
AllowOverride All
Options Indexes FollowSymLinks
<IfDefine APACHE24>
Require local
Require ip 192.168.2
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.0 localhost ::1
</IfDefine>
</VirtualHost>
最后,如果您的意思是在Apache中启用了vhost_alias_module
,那么为了使用这样的虚拟主机,您不需要这样做,因此您应该禁用它。
要激活extra\vhost-httpd.conf
更改,请不要忘记在httpd.conf
文件中取消注释此行,以便包含此额外文件。
Include conf/extra/httpd-vhosts.conf