无法将Nginx配置为具有上下文路径的tomcat的代理 [英] Can't configure nginx as a proxy for tomcat with context path
本文介绍了无法将Nginx配置为具有上下文路径的tomcat的代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使Tomcat的应用程序可在 http://localhost:8080/application 上访问.
Having Tomcat with application accessible on http://localhost:8080/application.
想通过URL http://app.ru 访问此应用程序.所以这是nginx代理配置:
Want to have access to this application via url http://app.ru. So here's nginx proxy config:
server {
server_name app.ru .app.ru;
listen 80;
location / {
proxy_pass http://localhost:8080/application;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
当移动到 http://app.ru 时,它将返回302重定向到
When moving to http://app.ru, it return 302 redirect to http://app.ru/application
如何解决?
推荐答案
感谢@Richard Smith的评论.我忘记了斜杠.
Thanks for @Richard Smith comment. I've forgotten the trailing slash.
这篇关于无法将Nginx配置为具有上下文路径的tomcat的代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文