为啥https会自动301跳转到http?
有个站点,刚刚成功的安装了 Let’s Encrypt 的免费证书,nginx已经配置了关于https的访问。
现在可以通过 https 和 http 两种方式访问了,有些页面两种方式都可以访问,但是部分页面通过https访问竟然会 301 跳转到 http 页面地址,例如:
https://www.phpernote.com/php-template/200.html
这是为什么呢?请各位大神各抒己见,多谢!
nginx 配置如下:
server {
listen 80;
server_name www.phpernote.com ;
root /home/xxx/xxx;
location / {
index index.php index.html;
}
include /home/xxx/xxx/.htaccess;
location ~ ^(?:(?<!\.php).)+\.php($|/.*) {
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;
}
}
server {
listen 80;
server_name phpernote.com ;
root /home/xxx/xxx;
location / {
index index.php index.html;
}
include /home/xxx/xxx/.htaccess;
location ~ ^(?:(?<!\.php).)+\.php($|/.*) {
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;
}
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/letsencrypt/live/www.phpernote.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.phpernote.com/privkey.pem;
server_name www.phpernote.com ;
root /home/xxx/xxx;
location / {
index index.php index.html;
}
include /home/xxx/xxx/.htaccess;
location ~ ^(?:(?<!\.php).)+\.php($|/.*) {
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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
配置信息应该没问题,
include /home/xxx/xxx/.htaccess;
这里有什么特殊的配置?
更改配置后有 重启nginx 么