我在设置新项目上有问题。我刚安装了wamp 2.2E。我正在使用windows。在文件夹/www中,我创建了文件夹/example。在WINDOWS/system32 32/驱动程序/etc/主机中,我添加了
127.0.0.1 dev.example.com在G:\wamp\bin\apache\apache2.2.22\conf\extra\httpd-vhosts.conf中,在末尾添加
NameVirtualHost dev.example.com:80
<VirtualHost dev.example.com:80>
DocumentRoot "G:/wamp/www/example"
ServerName dev.example.com
ServerAlias dev.example.com
<Directory "G:/wamp/www/example">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>问题是当我转到dev.example.com/index.php时,我仍然从www/index.php获得内容,而不是www/example.com/index.php。我错过什么了吗?
发布于 2012-08-20 12:44:31
可能是在更改之后您没有重新启动apache服务器吗?
这里有一个我自己的vhost:
首先,您需要在httpd-vhosts.conf文件的开头添加:
NameVirtualHost *:80 然后,vhost定义本身:
<VirtualHost *:80>
DocumentRoot "C:/WEB/DOCUMENT_ROOT/www_foxmask/www/"
ServerName foxmask.localhost
<Directory "C:/WEB/DOCUMENT_ROOT/www_foxmask/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
CustomLog "C:\WEB\DOCUMENT_ROOT\apache_logs\www_foxmask.log" common
ErrorLog "C:\WEB\DOCUMENT_ROOT\apache_logs\www_foxmask-error.log"
</VirtualHost>nota :在您的httpd.conf中,您应该使用这一行使httpd-vhosts.conf正确工作:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf文件的路径取决于您的安装。
希望这能帮上忙
发布于 2012-08-20 12:51:24
试试VirtualHost *:80
据我所知,DNS的名称是由ServerAlias使用的。
如果您有一个仅以ServerAlias作为通配符的*,则在*条目之前设置dev.example.com。
发布于 2012-08-20 15:44:28
问题是我错过了一步。在文件中: G:\wamp\bin\apache\Apache2.2.22\conf\httpd.conf查找:#包含conf/extra/httpd-vhosts.conf并删除#
https://serverfault.com/questions/419909
复制相似问题