日期:2014-05-16 浏览次数:20777 次
基于域名的虚拟主机,一个IP对应多个网站
NameVirtualHost *
<VirtualHost *>
DocumentRoot d:/http/wwwroot
ServerName fading.cn
</VirtualHost>
<VirtualHost *>
DocumentRoot d:/http/wwwroot/Discuz!_6.0.0_SC_GBK/upload
ServerName dz6.fading.cn
</VirtualHost>
<VirtualHost *>
DocumentRoot d:/http/wwwroot/xspace/upload
ServerName x.fading.cn
</VirtualHost>
同时在C:\WINDOWS\system32\drivers\etc\hosts表中设置
127.0.0.1 ? ? localhost
127.0.0.1?? ? fading.cn
127.0.0.1?? ? dz6.fading.cn
127.0.0.1?? ? x.fading.cn
或者修改DNS,多个域名指向同一个IP地址
访问路径:
http://fading.cn或localhost
http://dz6.fading.cn
http://x.fading.cn
别名alias:
Alias /dz6/ "d:/http/wwwroot/Discuz!_6.0.0_SC_GBK/upload/"
<Directory "d:/http/wwwroot/Discuz!_6.0.0_SC_GBK/upload">
??? Options Indexes MultiViews
??? AllowOverride None
??? Order allow,deny
??? Allow from all
</Directory>
Alias /x/ "d:/http/wwwroot/xspace/upload/"
<Directory "d:/http/wwwroot/xspace/upload">
??? Options Indexes MultiViews
??? AllowOverride None
??? Order allow,deny
??? Allow from all
</Directory>
访问的时候一定用
http://localhost/x/
加上/
http://localhost/dz6/
加上/