晒下我的配置文件把,希望对你有帮助:
```nginx
server {
server_name
blog.ansheng.me;
listen 80;
listen 443 ssl;
set $rewriterule https;
if ($scheme = https) {
set $rewriterule "${rewriterule}7";
}
if ($host ~* ^
blog.ansheng.me) {
set $rewriterule "${rewriterule}8";
}
if ($rewriterule != "https78") {
return 301
https://blog.ansheng.me$request_uri;
break;
}
ssl_certificate /.../xxx.crt;
ssl_certificate_key /.../xxx.key;
ssl_trusted_certificate /.../xxx.crt;
......
}
```