配置文件目录:

/apache1/conf/extra/httpd-vhosts.conf

httpd-vhosts.conf文件中:

[root@test extra]# grep -v "#" httpd-vhosts.conf |grep -v "^$"
NameVirtualHost *:80         //端口  *代表所有地址
              //一个网络
    ServerAdmin [email protected]   //邮箱
    DocumentRoot "/usr/local/apache2/htdocs/www1/"
    ServerName              //域名
    ErrorLog "logs/error_log"
    CustomLog "logs/access_log" common


    ServerAdmin [email protected]
    DocumentRoot "/usr/local/apache2/htdocs/www2/"
    ServerName www.changhuanyan2.com
    ErrorLog "logs/error_log"
    CustomLog "logs/access_log" common