首页 > IT基础架构 > 网络安全 > apache中配置多个IP对应多个网站
1、首先 编辑vi httpd.conf
[@more@]添加多个Listen注释掉以下信息:
#ServerAdmin you@example.com
#DocumentRoot "/usr/local/apache/htdocs/newwt"
去掉以下注释:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
——〉
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
2、编辑/extra/ httpd-vhosts.conf
修改后内容如下:
NameVirtualHost 222.191.116.130:8080
NameVirtualHost 222.191.116.137:8080
#
# 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
#
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /usr/local/apache/htdocs/dxs
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot /usr/local/apache/htdocs/newwt
ServerName dummy-host.example.com
ErrorLog logs/dummy-host2.example.com-error_log
CustomLog logs/dummy-host2.example.com-access_log common
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9099175/viewspace-927084/ ,如需转载,请注明出处,否则将追究法律责任。