侧边栏壁纸
博主头像
★街角晚灯★博主等级

博观而约取 厚积而薄发

  • 累计撰写 466 篇文章
  • 累计创建 185 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Nginx的http请求强制跳转至https

WinJay
2021-12-21 / 0 评论 / 0 点赞 / 117 阅读 / 1198 字 / 正在检测是否收录...
温馨提示:
文章发布较早,内容可能过时,阅读注意甄别。。。。

Nginx的http请求强制跳转至https

upstream  xxxxRS{
    server  202.205.xxx.xxx;
}


server {
    # http请求通过301强制跳转至https
    listen 80;
    server_name xxxx.nercoa.com;
    return 301 https://$server_name$request_uri;    
}



server {
    listen 443 ssl;
    server_name xxxx.nercoa.com;

    ssl_certificate conf.d/ssl/002.xxxx.nercoa.com.pem;
    ssl_certificate_key conf.d/ssl/002.xxx.nercoa.com.key;
    ssl_session_timeout 5m;
    ssl_prefer_server_ciphers on;
    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;

    client_max_body_size 1000m;
    location / {
       proxy_redirect off;
       proxy_pass http://xxxxRS;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header Host $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区