linux显示302权限,为何宝塔开启SSL后网页状态码是302而不是301

如果想要301你可以跟我 一样设置两个server段即可

server{

listen 80;

server_name mrhee.com www.mrhee.com;

return 301 https://mrhee.com$request_uri;

}

server

{

listen 443 ssl http2;

server_name mrhee.com www.mrhee.com;

add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";

index index.php index.html index.htm default.php default.htm default.html;

root /www/wwwroot/mrhee.com;

#error_page 404/404.html;

limit_conn perserver 200;

limit_conn perip 20;

limit_rate 314k;

ssl_certificate    /etc/letsencrypt/live/mrhee.com/fullchain.pem;

ssl_certificate_key    /etc/letsencrypt/live/mrhee.com/privkey.pem;

ssl_session_timeout 5m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_prefer_server_ciphers on;

ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";

ssl_session_cache builtin:1000 shared:SSL:10m;

#openssl dhparam -out /www/server/nginx/conf/dhparam.pem 2048

ssl_dhparam /www/server/nginx/conf/dhparam.pem;

if ($server_port !~ 443){

rewrite ^/.*$ https://$host$uri;

}

error_page 497  https://$host$uri;

error_page 502 /502.html;

include enable-php-70.conf;

include /www/server/panel/vhost/rewrite/mrhee.com.conf;

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

access_log off;

}

location ~ .*\.(js|css)?$

{

expires      12h;

access_log off;

}

access_log  /www/wwwlogs/mrhee.com.log;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值