move SSL redirect into test file

This commit is contained in:
Asif Bacchus 2019-10-17 00:52:55 -06:00
parent 19a6f82b54
commit d3a349c167
2 changed files with 24 additions and 23 deletions

View File

@ -1,22 +0,0 @@
### redirect to secure site
server {
listen 80;
server_name default_server;
# redirect to properly formed HTTPS location
location / {
return 301 https://$host$request_uri;
}
# process Let's Encrypt challenges
location ^~ /.well-known/acme-challenge {
# log requests for security reasons
access_log /var/log/nginx/LetsEncrypt_access.log main;
error_log /var/log/nginx/LetsEncrypt_error.log warn;
default_type text/plain;
root /usr/share/nginx/html/letsencrypt;
autoindex on;
}
}

View File

@ -1,9 +1,32 @@
### UNsecured test page ### UNsecured test page
server { server {
listen 443; listen 80;
include /etc/nginx/server_names.conf; include /etc/nginx/server_names.conf;
# default redirect to properly formed HTTPS location
location / {
return 301 https://$host$request_uri;
}
# process Let's Encrypt challenges
location ^~ /.well-known/acme-challenge {
# log requests for security reasons
access_log /var/log/nginx/LetsEncrypt_access.log main;
error_log /var/log/nginx/LetsEncrypt_error.log warn;
default_type text/plain;
root /usr/share/nginx/html/letsencrypt;
autoindex on;
}
server {
listen 443 ssl https2;
include /etc/nginx/server_names.conf;
# ssl certificates
include /etc/nginx/ssl_certs.conf;
location / { location / {
try_files $uri $uri/ =404; try_files $uri $uri/ =404;
} }