标签 https 下的文章

upstream  你的域名  {
        server   localhost:9876;
}
server{
        listen 80;
        server_name 你的域名;
        rewrite ^(.*) https://$server_name$1 permanent;
        location / {
            proxy_pass        http://你的域名;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
}

server{
        listen  443 ssl;
        server_name  你的域名;
        ssl on;
        ssl_certificate crt文件目录/server.crt;
        ssl_certificate_key key文件目录/server.key;
        location / {
            proxy_pass        http://你的域名;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
    }