server {
listen 80;
server_name www.test.cn;
rewrite ^(.*) https://$server_name$1 permanent; ###nginx永久跳转
}
server {
listen 443 ssl;
server_name www.test.cn;
server_tokens off;
charset utf-8;
access_log /var/log/nginx/www.test.cn.log main;
ssl_certificate /etc/letsencrypt/live/yplsec.cn/fullchain.pem; ###证书
ssl_certificate_key /etc/letsencrypt/live/yplsec.cn/privkey.pem; ###密钥
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://10.10.10.16:8000/; ##反向代理地址
}
location ~* \.(bak|save|sh|sql|mdb|svn|git|old)$ {
deny all;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
原文:https://www.cnblogs.com/wangyong-blog/p/13674285.html