私は、HTTPSを強制するnginx v1.13のAngularアプリケーションを実行している本当にシンプルなDockerコンテナを持っています。シンプルなnginx/AngularプロジェクトのフォースHTTPS
私は書き換えルールを設定しようとしましたが、私はどちらかだけではルートドメイン(例:http://myapp.com - >https://myapp.com)に取り組んで取得ではなく、ページ上:私が試した
(すなわちhttp://myapp.com/login滞在HTTP) $ localhost、$ host、$ server_name、$ request_uriの別々の組み合わせですが、たいていはリダイレクトが多すぎます。
私のドメインには、IISでホストされている他のアプリケーションと連携して動作するSSL証明書があります。したがって、私はそれがちょうど私のnginx設定だと確信しています。ここ
は、設定ファイル(画像から不変)である:
`
サーバ{ 80を聴きます。 server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location/{
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /(assets)/ {
gzip_static on;
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/atom+xml;
expires off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
`` `
UPDATE:助けを
おかげで、それはAzureの設定の問題であることが判明。 SSLリダイレクトを許可するカスタムドメインオプションを設定する必要がありました。ローカルコンテナを実行しているlocalhost
が強制的にHTTPSのドメイン
Nginxの[SSL終了のドキュメントを読む](https://www.nginx.com/resources/admin-guide/nginx-ssl-termination/) – bluescores