nginx代理tomcat集群,无法跳转到tomcat

vstpd08 2018-01-08 02:06:36
我的nginx.conf配置如下
gzip on
upstream tomcat {
server 192.168.0.22:88 weight=1;
server 192.168.0.22:99 weight=2;
}
server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
proxy_pass http://tomcat;
}
tomcat的server.xml配置如下



启动两台tomcat7-1(端口88)和tomcat7-2(端口99),可以访问
192.168.0.22:88/test.html

192.168.0.22:88/test.html


但是192.168.0.22/test.html却无法访问,说明没有跳转到tomcat目录访问

查看nginx日志

还是访问的是nginx下的html目录。
问题是我所有的html页面和jsp页面都在tomcat的test目录下。

请问各位大侠,怎么解决这问题
...全文
1368 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenjian026 2019-02-16
  • 打赏
  • 举报
回复
需要在 location 中配置代理请求头就行了 proxy_set_header Host $host; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
印度张三 2018-11-06
  • 打赏
  • 举报
回复
是的,启动的时候需要制定配置文件的
josh_wang 2018-07-10
  • 打赏
  • 举报
回复
引用 2 楼 vstpd08 的回复:
这个配置本身没问题,是我在安装的时候把nginx.conf的指向直到别的目录了

后面怎么解决的
解决方案说说
我也有这样的问题
vstpd08 2018-01-23
  • 打赏
  • 举报
回复
这个配置本身没问题,是我在安装的时候把nginx.conf的指向直到别的目录了
weixin_38495365 2018-01-09
  • 打赏
  • 举报
回复
server_name localhost; 你用localhost/test.html试试

25,985

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧