/etc/httpd/conf/httpd.conf 尾部

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot /var/www/web3
    ServerName www.1.com
    #AddDefaultCharset UTF-8    #默认编码
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /var/www/web5
    ServerName www.2.com
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot /var/www/web2
    ServerName www.3.com
</VirtualHost>

//==================
如果只用一个IP
末尾添加如下几行:
NameVirtualHost 192.168.1.110
<VirtualHost www.test.com>
    ServerAdmin webmaster@test.com
    DocumentRoot /var/www/html
    ServerName www.test.com
</VirtualHost>
<VirtualHost www.website1.com>
    ServerAdmin webmaster@website1.com
    DocumentRoot /var/www/html/website1
    ServerName www.website1.com
</VirtualHost>
<VirtualHost www.website2.com>
    ServerAdmin webmaster@website2.com
    DocumentRoot /var/www/html/website2
    ServerName www.website2.com
</VirtualHost>

发表评论

电子邮件地址不会被公开。 必填项已用*标注