Generally, when using nginx to proxy tomcat as a cluster, proxy_pass in nginx is often used, but the following only receives
ip+port, most of the web is not arranged with the ROOT directory, so it needs to be converted
Just need to configure it under conf/server.xml.
Take the pos project release as an example, it is usually placed in webapps/pos , and is accessed at 192.168.0.5/pos . This is not easy
In the <Host> tag in conf/server.xml, add
<Context path="" docBase="/var/data/pos" debug="0" reloadable="false">
</Context>
Note: Because it is placed in the host, if it is an application based on webapps, the configuration Context will be loaded twice, and it will only be loaded once if it is absolutely not tomcat, which has two advantages:
1. The release program is safe and convenient
2. Solve proxy direct access
After restarting tomcat, you can directly access http://192.168.0.5 to start the pos project