如何在nginx中将http重定向到https,我的默认端口是nginx上的81

时间:2017-10-08 19:02:38

标签: http nginx https

  

我正在尝试将HTTP重定向到HTTPS。我的默认端口是nginx上的81。

server {
    listen 81;
    server_name deveshvyas.in;
    return 307 https: //deveshvyas.in$request_uri;
}

server {
    listen[::]: 443 ssl http2;
    listen 443 ssl http2;

    #
    ssl_code
    server_name deveshvyas.in;
    ssl_certificate / etc / nginx / ssl / nginx.crt;
    ssl_certificate_key / etc / nginx / ssl / nginx.key;
    location / {
        proxy_pass http: //127.0.0.1:3000;
    }
}
  

https工作正常,但重定向失败

0 个答案:

没有答案