NGINX强制使用https访问(http跳转到https)代码

server {
    listen 80;
    server_name example.com;  // 替换为你的域名

    # HTTP重定向到HTTPS
    rewrite ^(.*)$ https://$host$1 permanent;
}

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

滚动至顶部