常用命令
nginx -s reload 重新加载Nginx配置文件,然后以优雅的方式重启Nginx
负载均衡配置
server {
listen 1201;
root F:/git/study/nginxdemo1;
index index.html;
}
server {
listen 1202;
root F:/git/study/nginxdemo2;
index index.html;
}
server {
listen 1203;
root F:/git/study/nginxdemo3;
index index.html;
}
upstream node {
server localhost:1201;
server localhost:1202;
server localhost:1203;
}
server {
server_name localhost;
listen 1200;
location / {
proxy_pass http://node;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}