如何配置apache一个ip多域名的虚拟主机?
时间:2015-01-02 20:11 来源:linux.it.net.cn 作者:IT
这个必须要有,不然不能运行虚拟主机
NameVirtualHost *:80
然后设置:
<VirtualHost *:80>
DirectoryIndex default.php
ServerName "www.host1.com"
DocumentRoot "D:/wwwroot/host1/"
ErrorLog "H:/log/host1.log"
TransferLog "H:/log/host1access.log"
</VirtualHost>
<VirtualHost *:80>
DirectoryIndex default.php
ServerName "www.host2.com"
DocumentRoot "E:/wwwroot/host2/"
ErrorLog "H:/log/host2.log"
TransferLog "H:/log/host2access.log"
</VirtualHost>
另外,网站目录和日志目录必须存在,Apache不会自己建立目录的,不然Apache不能启动 (责任编辑:IT)
这个必须要有,不然不能运行虚拟主机 NameVirtualHost *:80 然后设置: <VirtualHost *:80> DirectoryIndex default.php ServerName "www.host1.com" DocumentRoot "D:/wwwroot/host1/" ErrorLog "H:/log/host1.log" TransferLog "H:/log/host1access.log" </VirtualHost> <VirtualHost *:80> DirectoryIndex default.php ServerName "www.host2.com" DocumentRoot "E:/wwwroot/host2/" ErrorLog "H:/log/host2.log" TransferLog "H:/log/host2access.log" </VirtualHost> 另外,网站目录和日志目录必须存在,Apache不会自己建立目录的,不然Apache不能启动 (责任编辑:IT) |