Rancher Server 设置
- Rancher 版本:
- 安装选项 (Docker install/Helm Chart):
- Helm Chart 安装
- Local集群 RKE1
- 在线部署
Rancher Server 部署的服务器IP
192.168.100.54
192.168.100.96
192.168.100.98
Nginx 部署的服务器IP
192.168.100.125
问题描述:
目前Rancher Server 已经可以正常使用, 修改hosts文件后, 通过域名访问可以正常登录Rancher
但是使用官网提供的方法用docker部署nginx服务器, 反向代理一直不生效
Nginx配置 nginx.conf
:
worker_processes 4;
worker_rlimit_nofile 40000;
events {
worker_connections 8192;
}
stream {
upstream rancher_servers_http {
least_conn;
server 192.168.100.54:80 max_fails=3 fail_timeout=5s;
server 192.168.100.96:80 max_fails=3 fail_timeout=5s;
server 192.168.100.98:80 max_fails=3 fail_timeout=5s;
}
server {
listen 80;
proxy_pass rancher_servers_http;
}
upstream rancher_servers_https {
least_conn;
server 192.168.100.54:443 max_fails=3 fail_timeout=5s;
server 192.168.100.96:443 max_fails=3 fail_timeout=5s;
server 192.168.100.98:443 max_fails=3 fail_timeout=5s;
}
server {
listen 443;
proxy_pass rancher_servers_https;
}
}
使用Docker启动Nginx服务:
docker run -d --restart=unless-stopped \
-p 80:80 -p 443:443 \
-v /root/nginx.conf:/etc/nginx/nginx.conf \
nginx:1.14
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8915ed0ea109 nginx:1.14 "nginx -g 'daemon of…" 3 hours ago Up 3 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp friendly_sammet
修改hosts文件
192.168.100.125 rancher.example.org
结果如下:
请问是否是nginx.conf
的配置错误? 该如何才能使用Nginx反向代理Rancher Server 呢?