Apache Httpd Setting up Multiple webserver Config changes

  1. Mod_Proxy module comes in-built with other Apache modules.Add/uncomment the below lines in $APACHE_HOME/conf/httpd.conf

    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so

  2. Add below lines to the end of $APACHE_HOME/conf/httpd.confProxypass /server1/ http://localhost:8080/
    ProxypassReverse /server1/ http://localhost:8080/

    Proxypass /server2/ http://localhost:8280/
    ProxypassReverse /server2/ http://localhost:8280/

  3. Setting up Virtual Host
    
    <VirtualHost *:80>
    
        ServerAdmin webmaster@localhost
        ServerName ci.company.com
        ServerAlias ci
        ProxyRequests Off
    
        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>
       
        ProxyPreserveHost on
        ProxyPass / http://localhost:8080/ nocanon
        AllowEncodedSlashes NoDecode
    
    </VirtualHost>
  4. Restart Apache service.
    Starting:
    
    service http stop
    
    

    Stopping:

    
    service http start
    
    

References

  1. https://httpd.apache.org/docs/2.4/vhosts/examples.html
  2. https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
  3. https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
  4. http://httpd.apache.org/docs/2.4/howto/reverse_proxy.html