Apache 你没有';设置vhost后,我没有权限访问/访问此服务器Windows 7上的WAMP服务器
我收到以下错误:您没有访问/此服务器的权限 在apache webserver中启用vhost插件,在vhost中,我有:Apache 你没有';设置vhost后,我没有权限访问/访问此服务器Windows 7上的WAMP服务器,apache,wamp,vhosts,Apache,Wamp,Vhosts,我收到以下错误:您没有访问/此服务器的权限 在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" comm
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/myfiles"
ServerName domain.com
ServerAlias domain.com
ErrorLog "logs/domain.com.log"
CustomLog "logs/domain.com" common
</VirtualHost>
DocumentRoot“C:/wamp/www/myfiles”
ServerName域名.com
ServerAlias domain.com
错误日志“logs/domain.com.log”
CustomLog“logs/domain.com”通用
在我的笔记本电脑上工作,而不是在运行windows7的tmp服务器上。首先,当您设置vhosts时,最好也为localhost创建一个 您还需要告诉apache允许从哪个ip地址接受每个vhost的连接 所以试试这个
# 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>
首先,在设置vhost时,最好也为localhost创建一个vhost 您还需要告诉apache允许从哪个ip地址接受每个vhost的连接 所以试试这个
# 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>
我使用的是vhost_alias_模块,所以我可以将我所有的vhost都放在该文件中(extras/vhost),所以我想一定有一些更新禁用vhost并将其直接添加到http.conf文件中!所以我想没关系,但是我无法让额外的/vhost配置工作。请看我更改的答案。我尝试了这个,并将配置移动到了那个位置,但没有运气,肯定是我的服务器不允许我使用vhost。您的示例在不使用vhost文件的情况下运行良好!谢谢!我使用的是vhost_alias_模块,所以我可以将我所有的vhost都放在该文件中(extras/vhost),所以我想一定有一些更新禁用vhost并将其直接添加到http.conf文件中!所以我想没关系,但是我无法让额外的/vhost配置工作。请看我更改的答案。我尝试了这个,并将配置移动到了那个位置,但没有运气,肯定是我的服务器不允许我使用vhost。您的示例在不使用vhost文件的情况下运行良好!谢谢!