Reverse proxy multiple tomcats on same nginx on same server -


i have 2 different versions of tomcat running on server , using nginx reverse proxy traffic on default 80 port. in server block cannot have tow locations /. tried change default root url of tomcat within server.xml using context element below.

and have server block as:

tomcat 7 homepage

location /tomsev {         proxy_pass  http://127.0.0.1:8080;     }         # tomcat 8 homepage     location / {         proxy_pass  http://127.0.0.1:9506;     } 

this loads ui placed in tomcat 8 not in 7. have servlet application deployed on tomcat 7. after many trials , errors finaly managed page loaded unable load css, js, mime files. throw unable load resources error. application url is: http://myserver.com/myapplication/landingpage.do

tomact 7: deployed application war file in webapp folder.

nginx config file:

server {    listen 80;    server_name myserver.com;      # tomcat 8 homepage     location / {       proxy_pass  http://127.0.0.1:9506;     }      location /myapplication/ {       proxy_pass    http://127.0.0.1:8080/myapplication/landingpage.do;     }   } 

do this

location /tomsev/ {     proxy_pass  http://127.0.0.1:8080/;    sub_filter_once off;    sub_filter '<head>' '<head>\n<base href="/tomsev/">'; }    

basically want change base url. can either change using nginx filter. or need adjust tomcat use baseurl. see below more details on

https://serverfault.com/questions/380200/adding-a-global-uri-prefix-for-tomcat-web-apps

if change base dir of tomcat config change below

location /tomsev/ {     proxy_pass  http://127.0.0.1:8080/tomsev/; }    

and basedir in tomcat server should tomsev


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -