Search code examples
apacheubuntu-server

Run 2 different apache servers on the same machine with different ports?


I would like to know if it's possible to have two apache server and able to set it for two different port, for example: 192.168.0.1:80 and 192.168.0.1:81. If it is possible, how to do it? For information, I'm on an ubuntu server machine.


Solution

  • Yes it is possible by configuring virtual hosts in apache, something like this...

        Listen 80
        Listen 81
        
    <VirtualHost *:80>
        DocumentRoot "/www/app1"
    
        # Other directives here
    </VirtualHost>
    
    <VirtualHost *:81>
        DocumentRoot "/www/app2"
    
        # Other directives here
    </VirtualHost>