I'm setting up my web server and I need to run tomcat on http://ip/tomcat/
instead of http://ip:8080/
. How I can do this on nginx? I've tried to find an answer in the internet, but all of them is useless for me.
My nginx configuration:
upstream tomcat {
server ip:8080;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location /tomcat/ {
proxy_pass http://tomcat;
}
}
Server answer: server answer image
Use below reverse proxy and test.
location /tomcat/ {
proxy_pass http://tomcat/;
}
Note: In IP address you need to use tomcat IP.
You can use /tomcat/ location with using below tag.
location /tomcat/ {
proxy_pass http://tomcat/;
}
When you are going to access manager page it opens http://IP/manager instead of http://IP/tomcat/manager cause /manager/html is harded in tomcat webapps/ROOT/index.jsp
<div class="button">
<a class="container shadow" href="/manager/html"><span>Manager App</span></a>
</div>
If you want to access manager through tomcat location then change below code in tomcat ROOT/index.jsp
<div class="button">
<a class="container shadow" href="/tomcat/manager/html"><span>Manager App</span></a>
</div>
Restart tomcat and test.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.