Explicit redirect to https instead of rewrite rule

Risto Helinko 2020-11-06 12:19:54 +02:00
parent fae0b276b3
commit 580ec9f6d3
1 changed files with 9 additions and 7 deletions

View File

@ -1,13 +1,15 @@
# web service1 config.
server {
listen 80;
listen 443 ssl http2;
server_name web;
listen [::]:80;
server_name localhost;
return 301 https://$server_name$request_uri;
}
# web service1 config.
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name localhost;
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
# Path for SSL config/key/certificate
ssl_certificate /etc/ssl/certs/nginx/misp.crt;
ssl_certificate_key /etc/ssl/certs/nginx/misp.key;