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,12 +1,14 @@
# web service1 config.
server {
listen 80;
listen 443 ssl http2;
server_name web;
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
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;
# Path for SSL config/key/certificate
ssl_certificate /etc/ssl/certs/nginx/misp.crt;