apache中配置多個IP對應多個網站

lishiran發表於2007-07-19

1、首先 編輯vi httpd.conf

[@more@]新增多個Listen
Listen 222.191.116.130:8080
listen 222.191.116.137:8080

註釋掉以下資訊:
#ServerAdmin

#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 block.
#

ServerAdmin
DocumentRoot /usr/local/apache/htdocs/dxs
ServerName dummy-host.example.com
ServerAlias
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common


ServerAdmin
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部落格 ” ,連結:http://blog.itpub.net/9099175/viewspace-927084/,如需轉載,請註明出處,否則將追究法律責任。

相關文章