Apache through different IP to configure multiple web sites

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

Apache through different IP to configure multiple web sites

 

First for the configuration of multiple IP addresses, hypothesis: 10.18.5.57, 10.18.5.58.
Then edit /etc/httpd/conf/httpd.conf, do a little modification:

1, Add multiple Listen
Listen 10.18.5.57:80
Listen 10.18.5.58.80

2, Comment out the following information
#ServerAdmin
#DocumentRoot "/var/www/html"

3, Add the following content
NameVirtualHost 10.18.5.57:80
NameVirtualHost 10.18.5.58:80

<VirtualHost 10.18.5.57:80>
ServerAdmin
DocumentRoot /var/www/html
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost 10.18.5.58:80>
ServerAdmin
DocumentRoot /var/www/html1
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

4, Service Apache restart
service httpd restart

In accordance with the above method, the Linux, through the Apache server, use a different IP address configuration of different sites.

2011-03-08 10:37

APACHE is a virtual host two servername


 

<VirtualHost ip:80>
ServerAdmin webmaster@localhost
DocumentRoot /usr/local/www/html/domain.com
ServerName domain.com
ServerAlias domain.com www.domain.com
</VirtualHost>


 

 

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Selina at February 05, 2014 - 8:47 AM