Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

One CentOS box comes with 2 LAN cards, one is for intranet (192.168.30.5), one is for public access (210.102.1.50). How can I config httpd.conf such that traffics from each IP will access to a different document root? i.e.: traffic from intranet -> /var/www/html/intranet/, traffic from the web -> /var/www/html/internet/

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You want a virtual host (Apache Virtual Host Documents). A virtual host can do exactly what your describing (assuming your using apache httpd) - this information is put into your httpd.conf

An example, modified from their website:

<VirtualHost 192.168.30.5>
DocumentRoot /var/www/html/intranet
ServerName www.domain.tld
</VirtualHost>

<VirtualHost 210.102.1.50>
DocumentRoot /var/www/html/internet
ServerName www.domain.tld
</VirtualHost>

There are many more options, such as custom logs and such, please refer to the documentation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.