日期:2014-05-17  浏览次数:21006 次

怎么用apache建多个网站啊
能不能用apache建多个网站啊,可以像IIS一样,用主机头
有没有什么办法啊

------解决方案--------------------
探讨
当然有办法.. 看手册 VirtualHost 章节...

------解决方案--------------------
Listen 127.0.0.1:8080
Listen 127.0.0.1:8081

<VirtualHost 127.0.0.1:8080>
DocumentRoot E:/0
<Directory E:/0>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost> 

<VirtualHost 127.0.0.1:8081>
DocumentRoot E:/1
<Directory E:/1>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
------解决方案--------------------
主机头 来了

<VirtualHost *>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>