NGINX配置文件修改

#SSL-START 
#error_page 404/404.html;
#HTTP_TO_HTTPS_START
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Content-Security-Policy "upgrade-insecure-requests";
if ($server_port !~ 443){
   rewrite ^(/.*)$ https://$host$1 permanent;
    }
 #HTTP_TO_HTTPS_END

上方作为参考,主要是添加以下代码:

add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Content-Security-Policy "upgrade-insecure-requests";

 

参考资料

https://asuhe.jp/daily/richangjilubenci3yue6rifuwuqishengjineirongjiyudaodewenti

点击数:23