Apache 虚拟机简单配置

xiaoxin0 2011-03-24

Apache 虚拟机简单配置

配置虚拟机主要是基于主机名的虚拟主机(一个IP地址,多个网站)。

配置方法:

1,修改httpd.conf文件,去掉#Include conf/extra/httpd-vhosts.conf前面的#,让httpd.conf包含httpd-vhosts.conf文件

2,修改httpd-vhosts.conf文件,添加虚拟机

<VirtualHost *:80> --监听的端口

[email protected]

DocumentRoot"/usr/local/apache/docs/dummy-host2.example.com"--目录路径

ServerNamedummy-host2.example.com域名

ErrorLog"logs/dummy-host2.example.com-error_log"日志

CustomLog"logs/dummy-host2.example.com-access_log"common

</VirtualHost>

<VirtualHost*:80>

[email protected]

DocumentRoot"/usr/local/apache/htdocs/vh01"

ServerNamec1.cj.com

</VirtualHost>

<VirtualHost*:80>

[email protected]

DocumentRoot"/usr/local/apache/htdocs/vh02"

ServerNamec2.cj.com

</VirtualHost>

3,重启apache

相关推荐