upstream api.xxx.com {
server 1.1.1.1:10001 weight=1 max_fails=3 fail_timeout=20s;
server 1.1.1.2:10001 weight=1 max_fails=3 fail_timeout=20s;
}
server{
listen 80;
server_name api.xxx.com;
location / {
proxy_pass http://api.xxx.com;
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_set_header X-remoteip $http_x_forwarded_for;
}
}
server {
listen 443 ssl;
server_name api.xxx.com;
ssl_certificate /usr/local/nginx/sslkey/xxx.com.crt;
ssl_certificate_key /usr/local/nginx/sslkey/xxx.com.crt;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://api.xxx.com;
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_set_header X-remoteip $http_x_forwarded_for;
}
}
最后修改:2023 年 11 月 02 日
© 允许规范转载