本站配置SSL后强制http跳转到https记录
阅读量 次
由于wordpess博客用到rewrite,所以网上很多的教程都不适用,总会提示服务器重定向过多,最后将NGINX配置文件改为如下后正常。
server {
listen 80;
server_name www.1985y.com;
rewrite ^/(.*) https://www.1985y.com/$1 permanent;#关键代码}
server
{
listen 443;
server_name www.1985y.com;
index index.html index.htm index.php;
root /home/wwwroot;
location ~.*.(gif|jpg|jpeg|png|bmp|swf|flv|mp3|wma)$
{
expires 30d;}
location ~.*.(js|css)$
{
expires 12h;}
ssl on;#关键代码
ssl_certificate /usr/local/nginx/conf/ssl/public.crt;#关键代码
ssl_certificate_key /usr/local/nginx/conf/ssl/private.key;#关键代码
}
📮邮件订阅