<body>
[2013-11-03修改]
我自己测试了下,把虚拟子目录移出Wamp\www目录,比如在其他磁盘新建个目录存放子目录,这样问题好像解决了,但是还是不知道为什么。
环境:windows server 2003
软件:wamp 版本 2.4
目前状态:服务器正常,web外网可以访问(通过8081端口),通过IP和域名都可访问
需求:我有多个子域名,想做虚拟目录,比如wamp\www\test\ 对应域名test.abc.com
问题:现在打开test.abc.com:8081 直接是 www目录,显示的是网页版的文件夹目录
(备注:我用的是8081端口)
我的处理过程:1.百度 谷歌找了些教程,配置:apache conf,配置如下:打开了 VirtualHost 的加载:
<code># Virtual hostsInclude conf/extra/httpd-vhosts.conf</code>
2.然后增加虚拟目录:
注释原来的
<code># #ServerAdmin [email protected] #DocumentRoot "c:/Apache24/docs/dummy-host.example.com" #ServerName dummy-host.example.com #ServerAlias www.dummy-host.example.com #ErrorLog "logs/dummy-host.example.com-error.log" #CustomLog "logs/dummy-host.example.com-access.log" common## #ServerAdmin [email protected] #DocumentRoot "c:/Apache24/docs/dummy-host2.example.com" #ServerName dummy-host2.example.com #ErrorLog "logs/dummy-host2.example.com-error.log" #CustomLog "logs/dummy-host2.example.com-access.log" common#</code>
增加新的虚拟目录
<code> Options Indexes Order allow,deny Allow from all DocumentRoot d:/wamp/www/test/ ServerPath d:/wamp/www/test/ ServerName test.abc.info</code>
结果打开还是:
大致情况就这样,希望大家帮我看看
这个问题已被关闭,原因:
回复内容:
<body>
[2013-11-03修改]
我自己测试了下,把虚拟子目录移出Wamp\www目录,比如在其他磁盘新建个目录存放子目录,这样问题好像解决了,但是还是不知道为什么。
环境:windows server 2003
软件:wamp 版本 2.4
目前状态:服务器正常,web外网可以访问(通过8081端口),本#文来源gaodai$ma#com搞$$代**码网$通过IP和域名都可访问
需求:我有多个子域名,想做虚拟目录,比如wamp\www\test\ 对应域名test.abc.com
问题:现在打开test.abc.com:8081 直接是 www目录,显示的是网页版的文件夹目录
(备注:我用的是8081端口)
我的处理过程:1.百度 谷歌找了些教程,配置:apache conf,配置如下:打开了 VirtualHost 的加载:
<code># Virtual hostsInclude conf/extra/httpd-vhosts.conf</code>
2.然后增加虚拟目录:
注释原来的
<code># #ServerAdmin [email protected] #DocumentRoot "c:/Apache24/docs/dummy-host.example.com" #ServerName dummy-host.example.com #ServerAlias www.dummy-host.example.com #ErrorLog "logs/dummy-host.example.com-error.log" #CustomLog "logs/dummy-host.example.com-access.log" common## #ServerAdmin [email protected] #DocumentRoot "c:/Apache24/docs/dummy-host2.example.com" #ServerName dummy-host2.example.com #ErrorLog "logs/dummy-host2.example.com-error.log" #CustomLog "logs/dummy-host2.example.com-access.log" common#</code>
增加新的虚拟目录
<code> Options Indexes Order allow,deny Allow from all DocumentRoot d:/wamp/www/test/ ServerPath d:/wamp/www/test/ ServerName test.abc.info</code>
结果打开还是:
大致情况就这样,希望大家帮我看看
这样..
<code class="lang-bash">#httpd.conf里的 default serverNameVirtualHost *:80 ServerName localhost DocumentRoot "D:\wamp\www" ServerAdmin [email protected] conf/vhost/*-vhost.conf</code>
<code class="lang-bash">#这个是对应的 /vhost/project1-vhost.conf DocumentRoot "D:\wamp\www\project1" ServerName project1.com</code>
<code> #端口号不用改 ServerAdmin [email protected] #这里是你的网站管理员的邮箱,一般随便设置一个 DocumentRoot "c:/wamp/www/domain.com" #这里是你的网站根目录 对应HOSTS文件中要添加对应的IP跟域名 ServerName domain.com #这里是你的域名</code>
建议转用XAMPP,现在WAMP发展的有点不太给力。
你的第一步是正确的,后面的其实在httpd-vhosts.conf这个文件里有示例的,你取消注释一个,改成自己的域名就可以了,HOSTS里面一定要添加你设置的域名。