nginx负载均衡配置
配置nginx
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#把tomcat服务器配置在这里
upstream localhost{
server localhost:8180 weight=1;
server localhost:8280 weight=1;
server localhost:8380 weight=1;
}
server {
listen 80;
server_name localhost; #域名映射 (可选)
location / {
proxy_pass http://localhost; #代理域名
proxy_connect_timeout 500ms; #超时时间 毫秒
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
配置tomcat集群
Server7-1 : 8021 8180 8019
Server7-2 : 8031 8280 8029
Server7-3 : 8041 8380 8039