在nginx 目录下打开 nginx.conf
在http {
下修改 增加:
upstream redislock{ server 192.168.0.106:8001 weight=1; // 自己部署到服务地址和端口 server 192.168.0.106:8002 weight=1; // 自己部署到服务地址和端口
}
location / {
root html;
index index.html index.htm;
proxy_pass http://redislock;
}
如下所示:
upstream redislock{ server 192.168.0.106:8001 weight=1; server 192.168.0.106:8002 weight=1; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; proxy_pass http://redislock; }
访问:127.0.0.1:80 会轮询请求到服务
192.168.0.106:8001
192.168.0.106:8002