nginx - 在 nginx 代理中设置 Tomcat
问题描述
我正在设置我的网络服务器,我需要运行 tomcathttp://ip/tomcat/
而不是http://ip:8080/
. 我如何在 nginx 上做到这一点?我试图在互联网上找到答案,但所有这些对我来说都没用。
我的 nginx 配置:
upstream tomcat {
server ip:8080;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
location /tomcat/ {
proxy_pass http://tomcat;
}
}
服务器回答: 服务器回答图片
解决方案
使用下面的反向代理和测试。
location /tomcat/ {
proxy_pass http://tomcat/;
}
注意:IP 地址中需要使用 tomcat IP。
推荐阅读
- javascript - 设置整个 redux 存储数据
- sed - 如何在 CircleCI 任务中访问构建 ID
- c# - VS Code 中的 C# 语义突出显示
- c# - DotNet Core 3.1 Web API + AutoMapper:mapper.map 方法中的错误
- angular - minikube 上的 Angular 应用程序:没有错误的空白页面
- typescript - 获取 Typescript 中选定选项的值
- office365 - 用于插件的 Office js api 中的事件
- c++ - 打开文件对话框未正确显示初始文件名
- javascript - Request.cookies.session 为空
- tensorflow - 训练误差和测试误差之间的差距很小,这是否意味着过度拟合?