在wamp设置中,我无法为我的应用程序设置虚拟主机。
Appache; d:\瓦帕\ BIN \阿帕奇\ apache2.2.8 \ CONF \额外
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
<VirtualHost 127.0.0.1>
DocumentRoot "D:/wamp/www/"
ServerName www.example.org
# ...
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot D:/wamp/www/facebook_post_style
ServerName www.example.net
ServerAlias *.example.net
# ...
</VirtualHost>
在主持人
C:\ Windows \ System32下\驱动程序\等\主机
127.0.0.1 www.example.org
127.0.0.1 www.example.net
我做了以上配置。对于这两个域,显示相同的输出。
请检查以下网址。
答案 0 :(得分:1)
试试这个
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\wamp\www\facebook_post_style"
ServerName www.example.net
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:\wamp\www\FolderName"
ServerName www.example.org
</VirtualHost>
还要确保您已从httpd.conf文件中取消注释以下行
Include conf/extra/httpd-vhosts.conf
查看此article了解详情
答案 1 :(得分:0)
以下东西虚拟主机工作Apache;
d:\瓦帕\ BIN \阿帕奇\ apache2.2.8 \ CONF \额外
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.localhost
#DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.localhost"
DocumentRoot "D:/wamp/www/"
ServerName localhost
#ServerAlias www.dummy-host.localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.localhost
# DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost"
DocumentRoot "D:/wamp/www/facebook_post_style"
ServerName localhost1
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.localhost
# DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost"
DocumentRoot "D:/wamp/www/crop"
ServerName www.example.net
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" common
</VirtualHost>
在主持人中:
C:\ Windows \ System32下\驱动程序\等\主机
127.0.0.1 localhost
127.0.0.1 localhost1
127.0.0.1 www.example.net
点击任务栏中的wamp图标&gt; Apache&gt;的httpd.conf
启用以下行
包括conf / extra / httpd-vhosts.conf