I'm a web developer and for a project I need to run tomcat and nodejs without using port.
I've seen some posts about proxy module in httpd, so I've created two virtual hosts as follow :
<VirtualHost *:80>
ServerName localhost
# ErrorLog "logs/tomcat-error.log"
ProxyPreserveHost On
ProxyPass /tomcat http://localhost:8080/
ProxyPassReverse /tomcat http://localhost:8080/
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
# ErrorLog "logs/nodejs-error.log"
ProxyPreserveHost On
ProxyPass /nodejs http://localhost:8000/
ProxyPassReverse /nodejs http://localhost:8000/
</VirtualHost>
And when I try to access both localhost/nodejs or localhost/tomcat I get a Not Found error.
Can someone explain me why ?
Thanks 😉
Best Answer
The first matched
VirtualHost
shadows the followings. So theProxyPass
tonodejs
is never reached.You should merge it all as:
Have you enabled the
proxy
andproxy_http
modules?And of course the tomcat and nodejs side should be in-place.