鍍金池/ 問(wèn)答/PHP  Linux  網(wǎng)絡(luò)安全  HTML/ 為啥https會(huì)自動(dòng)301跳轉(zhuǎn)到http?

為啥https會(huì)自動(dòng)301跳轉(zhuǎn)到http?

有個(gè)站點(diǎn),剛剛成功的安裝了 Let’s Encrypt 的免費(fèi)證書,nginx已經(jīng)配置了關(guān)于https的訪問(wèn)。

現(xiàn)在可以通過(guò) https 和 http 兩種方式訪問(wèn)了,有些頁(yè)面兩種方式都可以訪問(wèn),但是部分頁(yè)面通過(guò)https訪問(wèn)竟然會(huì) 301 跳轉(zhuǎn)到 http 頁(yè)面地址,例如:

https://www.phpernote.com/php-template/200.html

這是為什么呢?請(qǐng)各位大神各抒己見(jiàn),多謝!

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;
        }
}
回答
編輯回答
蝶戀花

配置信息應(yīng)該沒(méi)問(wèn)題,
include /home/xxx/xxx/.htaccess;
這里有什么特殊的配置?

更改配置后有 重啟nginx 么

2017年7月23日 12:28