Hi I am running multiple applications on the same machine like Plone which is using ZOPE application server that is running on port 8080 and Tomcat which is hosting multiple web applications and running on port 8081.
I want to redirect all my incoming traffic from apache server which is running on port 80 to these server, so that external world will see only apache's default port 80. I tried many configurations for doing the same but none of them seems to be working for both the severs but yes individually if I am configuring its working flawlessly. So, only one configuration is getting used and the other has no effect.
My configuration looks like: Pastebin Link
I also tried with the following configuration:
<VirtualHost *:80>
ServerName web.url.in
ProxyPreserveHost On
ProxyPass /MNCD2016 http://web.url.in:8081/MNCD2016
ProxyPassReverse /MNCD2016 http://web.url.in:8081/MNCD2016
RewriteEngine on
RewriteRule ^/$ http://web.url.in/MNCD2016
</VirtualHost>
<VirtualHost *:80>
ServerName web.url.in
ProxyPreserveHost On
ProxyPass / http://web.url.in:8080/
ProxyPassReverse / http://web.url.in:8080/
RewriteEngine on
RewriteRule ^/$ http://web.url.in/ckpw
</VirtualHost>
The problem is that the configuration works only for either one of the port not for both. For example if the Plone rewrite rule is above it will take the precedence and the other tomcat configuration will not work. Individually they work smoothly.
How can I make them work simultaneously for both the servers (Zope, Tomcat) may be even more in future. So, that I can divert all incoming request from apache to these servers and the external world should see only apache in the front not these servers.
This is the link which I followed for Plone configuration.
You don't want to have multiple VirtualHost blocks with the same ServerName value. Instead you want to have a single VirtualHost block per ServerName and use either ProxyPass of RewriteRule to route the traffic to the appropriate backends. Here's an example using ProxyPass: