首页  >  文章  >  后端开发  >  apache子域名设置

apache子域名设置

WBOY
WBOY原创
2016-06-23 14:03:031081浏览

本地的环境,apache的配置文件中设置的根目录是d:/AppServ/www/,子域名的配置如下,放在配置文件开始了

NameVirtualHost *:80<VirtualHost *:80>    ServerName localhost    ServerAlias localhost    DocumentRoot D:/AppServ/www/     <Directory D:/AppServ/www/>#	AllowOverride FileInfo Options	Options None	Order allow,deny	Allow from all    </Directory></VirtualHost><VirtualHost *:80>    ServerName dede    ServerAlias dede    DocumentRoot D:/AppServ/www/Dede/     <Directory D:/AppServ/www/Dede/>#	AllowOverride FileInfo Options	Options None	Order allow,deny	Allow from all    </Directory></VirtualHost><VirtualHost *:80>    ServerName ikaihui    ServerAlias ikaihui    DocumentRoot D:/AppServ/www/ikaihui/     <Directory D:/AppServ/www/ikaihui/>#	AllowOverride FileInfo Options	Options None	Order allow,deny	Allow from all    </Directory></VirtualHost>

现在的情况是:输dede和ikaihui都能正常显示,输localhost的话chrome会报这个错:
错误 103 (net::ERR_CONNECTION_ABORTED):未知错误。

IE也打不开。
删掉localhost那一段的话,输localhost会显示dede的页面,我现在想输localhost正常显示www文件夹下面的index.php,该怎么配


回复讨论(解决方案)

看看是不是你的反病毒或者防火墙之类导致的.

看看是不是你的反病毒或者防火墙之类导致的.
电脑上没有杀毒软件 而且去掉localhost那一段就能访问,应该还是哪儿的配置有问题

你的写法是正确的
清除一下浏览器缓冲区看看
我就是这样写的

NameVirtualHost *:80<VirtualHost *:80>ServerName localhostDocumentRoot /AMP/web</VirtualHost><VirtualHost *:80>ServerName www.a.netDocumentRoot /AMP/web/www.a.net</VirtualHost><VirtualHost *:80>ServerName www.b.netDocumentRoot /AMP/web/www.b.net</VirtualHost>

你的写法是正确的
清除一下浏览器缓冲区看看
我就是这样写的
Plain Text code?12345678910111213141516NameVirtualHost *:80 ServerName localhostDocumentRoot /AMP/web Se……
我照你这个改了 又把浏览器的缓存都清了 还是不行 搞不清楚哪的问题

那你把里面的 Directory 一节去掉看看

那你把里面的 Directory 一节去掉看看
去掉了 我就是照你上面的写的

加这个看下
Alias /绑定目录 "绝对物理路径" 

NameVirtualHost localhost:80


ServerName localhost
DocumentRoot /AMP/web



ServerName www.a.net
DocumentRoot /AMP/web/www.a.net



ServerName www.b.net
DocumentRoot /AMP/web/www.b.net


这样子你试试,应该可以

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn