-
新建项目
server { listen 9001; server_name test.com; location / { root /home/www/dist; index index.html; try_files $uri $uri/ /index.html; } }
-
配置反向代理
server { listen 9000; server_name test.com; location / { proxy_pass http://localhost:9001; } }
-
配置负载均衡
upstream test_upstream { server http://localhost:9001; server http://localhost:9002; server http://localhost:9003; } server { listen 9000; server_name test.com; location / { proxy_pass test_upstream; } }
-
更新 nginx 配置信息
nginx -s reload
使用 Nginx 配置负载均衡
最新推荐文章于 2024-04-02 09:53:38 发布