nginx实现负载均衡
其实配置非常简单nginx.conf:
#user nobody; worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #gzip on; upstream sphl520.taobao.com { server 192.168.1.121:8080; server 192.168.1.122:8080; } server { listen 80; server_name sphl520.taobao.com; charset utf-8; location / { root html; index index.html index.htm; proxy_pass http://sphl520.taobao.com; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } location ~ ^/(WEB-INF)/ { deny all; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
将http://sphl520.taobao.com替换成你的域名
192.168.1.121:8080和192.168.1.122:8080替换成你服务器的IP
OK,已经完成。启动nginx即可。
相关推荐
swtIrene 2020-08-14
slovyz 2020-08-14
tinydu 2020-08-03
yungame 2020-07-04
廖先贵 2020-06-23
畅聊架构 2020-06-10
魏莉的微 2020-06-07
后厂村老司机 2020-06-01
后厂村老司机 2020-05-08
后厂村老司机 2020-04-25
yungame 2020-04-19
wxthillwill 2020-04-10
tinydu 2020-03-27
yungame 2020-03-23
yungame 2020-03-01
快乐de馒头 2020-02-26
tinydu 2020-02-01
zllbirdonland 2020-01-29
zllbirdonland 2020-01-06