首页 > 代码库 > centos apache 多域名配置虚拟主机

centos apache 多域名配置虚拟主机

1、配置hosts文件

[root@zabbix_ttonnet ~]# cat /etc/hosts

123.58.250.36  monitor.ttonnet.com

123.58.250.36  leader.ttonnet.com


2、配置http 虚拟主机

1)、进入/etc/httpd/conf.d目录

2)、创建虚拟主机配置文件

[root@zabbix_ttonnet conf.d]# cat httpd-vhosts.conf

NameVirtualHost 123.58.250.36:80


<VirtualHost 123.58.250.36:80>


    DocumentRoot /var/www/monitor


    ServerName monitor.ttonnet.com


    ErrorLog /var/www/monitor/ttonnet.com-err.log


    CustomLog /var/www/monitor/ttonnet.com-access.log common


</VirtualHost>


<VirtualHost 123.58.250.36:80>


    DocumentRoot /var/www/leader


    ServerName leader.ttonnet.com


    ErrorLog /var/www/leader/ttonnet.com-err.log


    CustomLog /var/www/leader/ttonnet.com-access.log common


</VirtualHost>

[root@zabbix_ttonnet conf.d]#


3、重启apache

[root@zabbix_ttonnet conf.d]# /etc/init.d/httpd restart

停止 httpd:                                               [确定]

正在启动 httpd:httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 LoadModule auth_basic_module modules/mod_auth_basic.so

for ServerName

                                                           [确定]


本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1893830

centos apache 多域名配置虚拟主机