sách gpt4 ai đã đi

Cấu hình NGINX:

In lại 作者:行者123 更新时间:2023-12-04 19:41:55 30 4
mua khóa gpt4 Nike

我是 NGINX 的新手,我正在尝试对我们的 ERP 网络服务器进行负载平衡。我有 3 个网络服务器在由 websphere 提供支持的端口 80 上运行,这对我来说是一个黑盒子:

* web01.example.com/path/apphtml
* web02.example.com/path/apphtml
* web03.example.com/path/apphtml

NGINX 正在监听虚拟 URL ourerp.example.com 并将其代理到集群。

这是我的配置:

upstream myCluster {
ip_hash;
server web01.example.com:80;
server web02.example.com:80;
server web03.example.com:80;
}

máy chủ {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ourerp.example.com;
vị trí / {
rewrite ^(.*)$ /path/apphtml break;
proxy_pass http://myCluster;
}
}

当我只使用 proxy_pass 时,NGINX 会负载平衡但会将请求转发到 web01.example.com 而不是 web01.example.com/path/apphtml

当我尝试添加 url 重写时,它只是重写了虚拟 URL,我最终得到了 ourerp.example.com/path/apphtml。

是否可以在上游级别进行 URL 重写或在上游级别将路径附加到应用程序?

1 Câu trả lời

如果您尝试通过代理将 / 映射到 /path/apphtml/,请使用:

proxy_pass http://myCluster/path/apphtml/;

Xem thêm this document了解更多。

rewrite 语句的问题是替换字符串末尾缺少 $1。参见 this document有关更多信息,但正如我上面指出的,您不需要 rewrite 语句,因为 proxy_pass 语句无论如何都能够完成相同的工作。

关于NGINX 配置 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44730854/

30 4 0
Bài viết được đề xuất: Twilio 队列溢出错误 : how large is the queue?
Bài viết được đề xuất: pdf - Libreoffice 在命令行上将 HTML 转换为 PDF 会产生空页面
Bài viết được đề xuất: oop - 如何模拟依赖于基础物质的措施
Bài viết được đề xuất: scala - 将时间戳转换为间隔
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com