You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
53 lines
1.5 KiB
worker_processes 1; |
|
events { |
|
worker_connections 1024; |
|
} |
|
|
|
http { |
|
include mime.types; |
|
default_type application/octet-stream; |
|
sendfile on; |
|
keepalive_timeout 65; |
|
|
|
# log_format main '{"@timestamp":"$time_iso8601",' |
|
# '"host":"$server_addr",' |
|
# '"clientip":"$remote_addr",' |
|
# '"size":"$body_bytes_sent",' |
|
# '"responsetime":"$request_time",' |
|
# '"user_agent":"$http_user_agent",' |
|
# '"request":"$request",' |
|
# '"request_method":"$request_method",' |
|
# '"uri":"$uri",' |
|
# '"domain":"$host",' |
|
# '"xff":"$http_x_forwarded_for",' |
|
# '"referer":"$http_referer",' |
|
# '"status":"$status"}'; |
|
# access_log /var/log/nginx.log main; |
|
|
|
# Nginx 负载均衡实现服务器的集群 |
|
upstream spring-boot-es { |
|
#weight 权重(数字越大,表明请求到的机会越大) |
|
server 192.168.0.111:60 weight=5; |
|
server 192.168.0.112:60 weight=5; |
|
# 备份服务器 |
|
server 192.168.0.110:60 backup; |
|
} |
|
|
|
server { |
|
listen 80; |
|
server_name localhost; |
|
|
|
location / { |
|
proxy_pass http://spring-boot-es; |
|
proxy_set_header Host $host; |
|
# proxy_set_header X-Forwarded-Host $server_name; |
|
proxy_set_header X-Real-IP $remote_addr; |
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
} |
|
|
|
error_page 500 502 503 504 /50x.html; |
|
location = /50x.html { |
|
root html; |
|
} |
|
} |
|
} |