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

[确定]

猜你在找的CentOS相关文章