某网站刚刚成功安装了let’s encrypt的免费证书,nginx已经配置了对https的访问。
现在可以同时通过https和http进行访问。 有些页面可以同时访问,但有些页面从https访问时,竟然会有301跳转到http页面地址。 示例:
为什么会这样呢? 感谢您的聆听。
nginx的结构如下。
服务器{
listen 80
server_name www.phpernote.com;
root /home/xxx/xxx;
位置/{
index index.php index.html;
}
include /home/xxx/xxx/.htaccess;
location ~ ^? (?
fastcgi _ pass UNIX :/tmp/PHP-CGI.sock;
fastcgi_index index.php;
fastcgi _ split _ path _ info ^ (.(.PHP )/. ) $;
fastcgi _ param script _ filename $ document _ root $ fastcgi _ script _ name;
fastcgi _ param path _ info $ fastcgi _ path _ info;
fastcgi _ param path _ translated $ document _ root $ fastcgi _ path _ info;
include fastcgi_params;
}
}
服务器{
listen 80
server_name phpernote.com;
root /home/xxx/xxx;
位置/{
index index.php index.html;
}
include /home/xxx/xxx/.htaccess;
location ~ ^? (?
fastcgi _ pass UNIX :/tmp/PHP-CGI.sock;
fastcgi_index index.php;
fastcgi _ split _ path _ info ^ (.(.PHP )/. ) $;
fastcgi _ param script _ filename $ document _ root $ fastcgi _ script _ name;
fastcgi _ param path _ info $ fastcgi _ path _ info;
fastcgi _ param path _ translated $ document _ root $ fastcgi _ path _ info;
include fastcgi_params;
}
}
服务器{
listen 443 ssl;
ssl on;
SSL _ certificate/etc/lets encrypt/live/www.phper note.com/full chain.PEM;
SSL _ certificate _ key/etc/lets encrypt/live/www.phper note.com/privkey.PEM;
server_name www.phpernote.com;
root /home/xxx/xxx;
位置/{
index index.php index.html;
}
include /home/xxx/xxx/.htaccess;
location ~ ^? (?
fastcgi _ pass UNIX :/tmp/PHP-CGI.sock;
fastcgi_index index.php;
fastcgi _ split _ path _ info ^ (.(.PHP )/. ) $;
fastcgi _ param script _ filename $ document _ root $ fastcgi _ script _ name;
fastcgi _ param path _ info $ fastcgi _ path _ info;
fastcgi _ param path _ translated $ document _ root $ fastcgi _ path _ info;
include fastcgi_params;
}
}