2016-05-19 9 views
1

This投稿は私が探しているものに非常に近いです。しかし、私が探しています、私は1つのサブドメイン以外のすべてをhttpsにリダイレクトしますか?

server { 
    listen 80; 
    server_name test.example.com; 
    rewrite ^ https://$http_host$request_uri? permanent; 
} 

でhttpsにすべてのHTTPを書き換えた後、以降

server { 
    listen 443 ssl; 
    ... 

質問

を行うことができます thisポストからのソリューションを使用して

letsencrypt.example.com should always be http 
      *.example.com should always be https 

です

しかし、どうすればいいですかletsencrypt.example.comがhttpポート80に残っていることを確認してください。

答えて

1

letsencrypt.example.comに明示的なサーバーを使用し、リダイレクトにキャッチオールサーバーを使用する必要があります。

あなたのポート80個のサーバブロックは次のようになります。

server { 
    listen 80; 
    server_name letsencrypt.example.com; 
    ... 
} 
server { 
    listen 80 default_server; 
    return 301 https://$http_host$request_uri; 
} 

の詳細についてはthis documentationを参照してください。

関連する問題