#安装
yum install httpd
#设置自启
systemctl enable httpd.service
#编辑httpd.conf就够了,httpd.conf在/etc/httpd/conf中。在底部加上虚拟主机
vim /etc/httpd/conf/httpd.conf
-------------------------------------------------------------------------------
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.xm10000.com.cn
ServerAlias xm10000.com.cn *.xm10000.com.cn
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://www.xm10000.com.cn:81/
ProxyPassReverse / http://www.xm10000.com.cn:81/
ErrorLog logs/xm10000_error_log
CustomLog logs/xm10000_access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName www.titantec.cn
ServerAlias titantec.cn *.titantec.cn
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://www.titantec.cn:82/
ProxyPassReverse / http://www.titantec.cn:82/
ErrorLog logs/titantec_error_log
CustomLog logs/titantec_access_log common
</VirtualHost>
-------------------------------------------------------------------------------
yum install httpd
#设置自启
systemctl enable httpd.service
#编辑httpd.conf就够了,httpd.conf在/etc/httpd/conf中。在底部加上虚拟主机
vim /etc/httpd/conf/httpd.conf
-------------------------------------------------------------------------------
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.xm10000.com.cn
ServerAlias xm10000.com.cn *.xm10000.com.cn
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://www.xm10000.com.cn:81/
ProxyPassReverse / http://www.xm10000.com.cn:81/
ErrorLog logs/xm10000_error_log
CustomLog logs/xm10000_access_log common
</VirtualHost>
<VirtualHost *:80>
ServerName www.titantec.cn
ServerAlias titantec.cn *.titantec.cn
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://www.titantec.cn:82/
ProxyPassReverse / http://www.titantec.cn:82/
ErrorLog logs/titantec_error_log
CustomLog logs/titantec_access_log common
</VirtualHost>
-------------------------------------------------------------------------------
本文介绍如何使用yum安装Apache服务,并通过编辑httpd.conf文件来配置两个不同的虚拟主机,包括设置ServerName、ServerAlias及代理等参数。
2705

被折叠的 条评论
为什么被折叠?



