首页 > Web开发 > 详细

nginx反向代理及https

时间:2020-09-15 18:09:53      阅读:56      评论:0      收藏:0      [点我收藏+]

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;
}

nginx反向代理及https

原文:https://www.cnblogs.com/wangyong-blog/p/13674285.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!