跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • nginx proxy_pass upstream 长连接-动态变量
未分類
25 9 月 2020

nginx proxy_pass upstream 长连接-动态变量

nginx proxy_pass upstream 长连接-动态变量

資深大佬 : kokol 0

从 nginx 到 server 的连接是短连接,现在想设置长连接, 看网上的设置都是 keepalive,proxy_http_version 1.1,proxy_set_header Connection “” 3 个参数
http {
upstream BACKEND {
server 192.168.0.1:8080 weight=1 max_fails=2 fail_timeout=30s;
server 192.168.0.2:8080 weight=1 max_fails=2 fail_timeout=30s;
keepalive 300; // 这个很重要!
}
server {
listen 8080 default_server;
server_name “”;
location / {
proxy_pass http://BACKEND;
proxy_http_version 1.1; // 这两个最好也设置
proxy_set_header Connection “”;
}
}
}

但是我的 nginx.conf 里有 lua 写的代码,proxy_pass 是变量的形式

server {
listen 8080 default_server;
server_name “”;
location / {

— 代码里有设置$upstream 、$arg_symbol 、$args 的变量
proxy_pass $upstream$arg_symbol$args;
}
}
}

我怎样改成 upstream 的呢,我看 upstream 里只支持 IP 、域名、端口的形式

大佬有話說 (0)

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具