博客启用全站https

服务器的LNMP还是两年前的v1.1,刚好博客改版就顺便整个弄下,把LNMP升级到v1.3了。家里装的移动宽带,宽带流量被运营商劫持,老是觉得http登录不安全,就开启了全站https。
NGINX配置如下,将hjjia.com和www.hjjia.com全部301跳转至https://hjjia.com

server
{
listen 443;
ssl on;
ssl_certificate /root/hjjia.com.crt;
ssl_certificate_key /root/hjjia.com.key;
#listen [::]:80;
server_name hjjia.com www.hjjia.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/hjjia.com;
 
include wordpress.conf;
#error_page 404 /404.html;
include enable-php.conf;
 
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
 
location ~ .*\.(js|css)?$
{
expires 30d;
}
 
location ~ /\.
{
deny all;
}
 
access_log off;
}
 
server
{
listen 80;
server_name hjjia.com www.hjjia.com;
rewrite ^(.*) https://hjjia.com$1 permanent;
}