upstream myapp {
server xx.xx.xx.xx:xxxx;
server xx.xx.xx.xx:xxxx;
}
server {
listen 80;
listen 443 ssl;
server_name xxx.xxx.xxx;
ssl_stapling on;
ssl_stapling_verify on;
ssl_certificate /data/www/https/fullchain.crt;
ssl_certificate_key /data/www/https/private.pem;
ssl_session_timeout 5m;
#请按照以下协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
client_max_body_size 100m;
location / {
include uwsgi_params;
proxy_pass http://myapp;
}
}
upstream配置说明
upstream myapp1 {
server srv1.example.com weight=3;
server srv2.example.com;
server srv3.example.com down;
server srv4.example.com backup;
}
server {
location / {
proxy_pass http://myapp1;
}
}
在这个配置中,srv1.example.com被赋予了3倍的权重,srv3.example.com被标记为down,意味着它当前不可用,srv4.example.com被标记为backup,意味着它只在所有其他服务器都宕机时才会被使用。