upstream rcb1 {
ip_hash;
server 127.0.0.1:8888 weight=1 max_fails=10 fail_timeout=60;# 服务器1
server 11111:8888 weight=1 max_fails=10 fail_timeout=60;#服务器2
}
server {//http监听
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {//https 监听
listen 443;
server_name server;//域名 客户提供 小程序 ip地址 不支持访问
ssl on;
ssl_certificate /etc/nginx/ssl/royal-canon.cn.pem;
ssl_certificate_key /etc/nginx/ssl/royal-canon.cn.key;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:EECDH+AES256::!MD5;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://rcb1;
}
}