修改nginx配置文件
$ sudo vim /opt/nginx/conf/nginx.conf
server {
listen 80;server_name 2207.com;
charset utf-8;
location / {
proxy_pass http://load_balance_2207;
client_max_body_size 10m;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
}
location /status {
access_log off;
}
}
upstream load_balance_2207 {
server 10.46:9090 weight=10 ;
}
生效
$ sudo /opt/nginx/sbin/nginx -s reload
本文介绍如何配置Nginx实现对2207.com网站的负载均衡,通过设置监听端口、域名、字符集及代理规则等实现流量分发,并详细展示了upstream配置和location指令的具体用法。
444

被折叠的 条评论
为什么被折叠?



