httpsアクセス(httpからhttpsにジャンプ)を強制的に使用します。

610 ワード

業務はhttpsを通じてサービスを提供し、httpを入力して自動的にhttpsにジャンプします。
1.nginxのrewrite方法
すべてのhttp要求をrewriteでhttpsに書き換えるだけでいいです。
server{ listen 80; server_name quingliu.q.com rewrite^(.*)https://host$1 permant; }
2.index.ウェブページを更新する
index.
<html> <meta http-equiv="refresh" content="0;url=https://qunyingliu.qq.com/"> </html>
 
nginx設定
server{ listen 80; server_name quingliu.q.com location/{ #index.は仮想ホストの傍受ルートディレクトリの下に置いてあります。 root/data/websites/quningliu.q.com/http; } #404ページをhttpsのトップページにリダイレクトする。 error_page 404https://qunyingliu.qq.com/; }