Nginx 80 重定向至 443端口

server {
    listen 80;
    server_name www.yourdomain.com;
    rewrite ^(.*) https://$server_name$1 permanent;
}

server {
    listen 443 ssl;
    server_name www.yourdomain.com;
    root /home/www;

    ssl_certificate /path/to/certs/xxxxxx.crt;
    ssl_certificate_key  /path/to/certs/xxxxxx.key;
}

你可能感兴趣的:(Nginx 80 重定向至 443端口)