歡迎您光臨本站 註冊首頁

haproxy + nginx 時遇到的問題

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

haproxy + nginx 時遇到的問題

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
不知道要怎麼配置才能解決這個問題
《解決方案》

有人知道不
《解決方案》

有人知道不
《解決方案》

有人知道不

[火星人 ] haproxy + nginx 時遇到的問題已經有450次圍觀

http://coctec.com/docs/service/show-post-17555.html