linux nginx负载均衡
nginx安装不介绍了,可以使用宝塔安装,比较速度(https://www.cnblogs.com/baobaoxiaokeai/p/10966024.html)
增加 upstream xiaogui001 节点,upstream 中可以多个节点进行负载均衡
location /tool : 代表以tool开头的请求会进行转发
proxy_pass http://xiaogui001/ : http://xiaogui001/ 是 upstream 节点的名称
underscores_in_headers on; : 默认带下划线的head参数是不会传过去的,加上这个配置
修改完配置记得重载nginx文件才会生效
upstream xiaogui001 { server 120.78.127.54:7777; server 120.78.127.54:8888; } location /tool { proxy_pass http://xiaogui001/; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-real-ip $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; }
posted on 2019-06-03 11:36 xiaogui918 阅读(157) 评论(0) 编辑 收藏 举报