nginx将http自动跳转到https

在nginx中添加如下配置:

vim /usr/local/nginx/conf/vhost/www.bbmax.cc.conf

修改内容:

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

刷新配置:

/usr/local/nginx/sbin/nginx -s reload
如果觉得我的文章对你有用,请随意赞赏