Apache-一个IP多个主机域名

#配置虚拟主机名

NameVirtualHost 192.168.209.128

<VirtualHost 192.168.209.128>

    DocumentRoot /htdocs/win

    ServerName www.a.com

</VirtualHost>

<VirtualHost 192.168.209.128>

    DocumentRoot /htdocs/manager

    CustomLog /htdocs/manager/home-access_log common

    ServerName www.b.com

</VirtualHost>



#配置对应目录访问权限



<Directory "/htdocs/win">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>



<Directory "/htdocs/manager">

    Options Indexes FollowSymLinks

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>



#配置完毕后重启Apache并修改host文件使www.a.com和www.b.com都指向192.168.209.128

 

你可能感兴趣的:(apache)