隐藏

nginx从http跳转到https

发布:2022/8/18 17:04:14作者:管理员 来源:本站 浏览次数:880


upstream www.begon.cn {

server localhost:7002 weight=1;
#server localhost:90 weight=2;
}
server {
  listen   80;
  server_name  www.begon.cn;
  return   301 https://$server_name$request_uri;
}
 
server {
     listen   443 ssl;
     server_name  www.begon.cn;
     ssl_certificate   C:\\Tools\ssl\\lecturer\\teacher.ysehs.com_bundle.pem;
     ssl_certificate_key  C:\\Tools\ssl\\lecturer\\teacher.ysehs.com.key;
     ssl_session_timeout 20m;
     ssl_session_cache shared:SSL:50m;
     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 / {

               root C:\\Tools\lecturerui;
              index index.html;
              try_files $uri $uri/ /index.html;
        }
        location /prod-api/ {
            proxy_pass http://www.begon.cn;
        }
}