Is 2 document root possible?

Discussion in 'Apache' started by vme64, Jan 25, 2008.

  1. #1
    Hi. Im trying to configure Apache to receive from ports 80 and 67000. I would like Apache to use DocumentRoot1 when request comes in from port 80 and to use DocumentRoot2 for request coming in from port 67000. Is this possible. How do I do this?
    Thanks.
     
    vme64, Jan 25, 2008 IP
  2. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #2
    You'll need to add a Listen directive, NameVirtualHost directive, & a <VirtualHost> container for the secondary port.

    The exact locations to add these is slightly different on various operating systems, but it boils down to having them included in httpd.conf or apache.conf either directly, or through files included by either of those two.

    Here's an example assuming you place everything in httpd.conf or apache.conf
    Listen 67000
    NameVirtualHost *:67000
    <VirtualHost *:67000>
    	DocumentRoot /var/www2/
    </VirtualHost>
    Code (markup):
    Apache needs to be restarted for the changes to take effect.

    If you have trouble finding out which files you need to add this too, go ahead and post your operating system.
     
    joebert, Jan 25, 2008 IP
    greatlogix likes this.