+ -
当前位置:首页 → 问答吧 → haproxy + nginx 时遇到的问题

haproxy + nginx 时遇到的问题

时间:2010-06-07

来源:互联网

haproxy在 前 nginx在后 最后是tomcat
haproxy 配置
listen lbserver *:80
  cookie JSESSIONID prefix

  option httpchk GET /index
  server nginx1 127.0.0.1:8001 weight 1 minconn 3 maxconn 6 check inter 20000


nginx配置
http {
  include mime.types;
  default_type application/octet-stream;
  sendfile on;

  keepalive_timeout 65;

  upstream tomcat{
  server 127.0.0.1:8080 weight=1;

  }

  server {
  listen 8001;
  server_name www.xxx.cn;


  location ~ ^/static.+\.(js|gif|jpg|jpeg|css|png|bmp|swf){
  root /websites/xxx;
  }

  location ~ .*\.(js|gif|jpg|jpeg|css|png|bmp|swf) {
  root /websites/xxxxx;
  }



  location / {
  proxy_pass http://tomcat;
  }


}

这样配置下来
当访问静态内容的时候正常
但一旦访问动态内容的时候 就会在url上显示8001端口
比如访问 www.xxx.cn/index.html正常
访问jsp 就会出现 www.xxx.cn:8001/index.jsp
不知道要怎么配置才能解决这个问题

作者: lich0079   发布时间: 2010-06-07

有人知道不

作者: lich0079   发布时间: 2010-06-08

热门下载

更多