0

在 wamp 设置中,我无法为我的应用程序设置虚拟主机。

阿帕奇;D:\wamp\bin\apache\apache2.2.8\conf\extra

#
# 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\drivers\etc\hosts

127.0.0.1        www.example.org
127.0.0.1        www.example.net

我做了上面的配置。对于这两个域,显示相同的输出。

请检查以下网址。在此处输入图像描述

4

2 回答 2

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

查看这篇 文章了解详情

于 2012-12-25T14:42:55.543 回答
0

使用下面的东西虚拟主机工作 Apache;

D:\wamp\bin\apache\apache2.2.8\conf\extra

<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\drivers\etc\hosts

127.0.0.1   localhost
127.0.0.1   localhost1
127.0.0.1   www.example.net

单击任务栏中的 wamp 图标 > Apache > httpd.conf

启用下面的行

虚拟主机

包括 conf/extra/httpd-vhosts.conf

于 2012-12-25T15:36:39.707 回答