当前位置: > Linux服务器 > apache >

Apache配置多网站多域名

时间:2014-05-20 12:07来源:linux.it.net.cn 作者:IT网
打开Apache配置文件httpd.conf,如默认情况下为 /etc/httpd/conf/httpd.conf
# vi /etc/httpd/conf/httpd.conf

把以下虚拟机的配置加在 httpd.conf  文件末尾即可

NameVirtualHost *:80               //注意:这行默认是有#号的,记得要去掉

# # VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for all requests that do not

# match a ServerName or ServerAlias in any block.

# ServerAdmin admin@centoscn.com

<VirtualHost *:80>
    ServerAdmin  admin@centoscn.com
    DocumentRoot  /var/www/html/centos
    ServerName www.centoscn.com
    ServerAlias www.centoscn.com
    ErrorLog logs/centoscn.com-error_log
    CustomLog log/centoscn.com-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin  admin@it.net.cn
    DocumentRoot /var/www/html/itwebsite
    ServerName www.it.net.cn
    ServerAlias www.it.net.cn
    ErrorLog logs/it.net.cn-error_log
    CustomLog logs/it.net.cn-access_log common
</VirtualHost>

(责任编辑:IT)
------分隔线----------------------------