ServerName:

ServerAlias:

DoucumentRoot "":

:文件系统路径

   option

   AllowOverride

Alias:

ErrorLog:

CustomLog:

:URL路径


ScriptAlias:

取消中心主机,注释DocumentRoot即可。

虚拟主机定义:


Host:

   基于ip

   ip1:80

   ip2:80

   基于port

   ip:80

   ip:8080

   基于域名

     ip|*:80

   ServerName 不同

apache2.4

/etc/httpd/extra/

virh.conf

ServerName www.a.com

DocumentRoot "/var/www/a.com/"

CustomLog  /var/log/httpd/a.com/access_log combined

ServerName www.b.org

DocumentRoot "/var/www/b.org"

ServerName www.c.net

DocumentRoot "/var/www/c.net"

    Options none

    AllowOverride none

    Order deny,allow

    Deny from 172.16.22.22

NameVirtualHost  172.16.0.2:80

ServerName www.d.gov

DocumentRoot "/var/www/d.gov"


设定默认虚拟主机

DocumentRoot "/var/www/default"