Fix SSL for staging nginx

This commit is contained in:
Ari Timonen 2020-04-09 03:36:19 +03:00
parent c1797204b5
commit 7fcfe27084
3 changed files with 13 additions and 15 deletions

View file

@ -13,4 +13,4 @@ STAGING_DOMAIN=www.ensl.org
STAGING_PORT=5001
STAGING_PORT_SSL=5000
MYSQL_DATABASE=ensl_staging
MYSQL_DATABASE=ensl_staging

View file

@ -155,8 +155,7 @@ services:
stdin_open: true
command: /bin/bash -c "envsubst '$$PUMA_PORT $$APP_PATH $$APP_PATH_PUBLIC $$STAGING_ROOT_DOMAIN $$STAGING_DOMAIN $$STAGING_PORT $$STAGING_PORT_SSL' < /etc/nginx/conf.d/*.conf.template > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/*.conf && nginx -g 'daemon off;'"
volumes:
- ./ext/ssl/fullchain.pem:/etc/ssl/certs/ensl_fullchain.pem
- ./ext/ssl/privkey.pem:/etc/ssl/private/ensl_privkey.pem
- ./ext/ssl:/etc/ssl/ensl
- ./ext/nginx.conf.d/:/etc/nginx/conf.d/
- ./public:/var/www/public
ports:
@ -185,4 +184,4 @@ services:
# and the container. It's not necessary to be able to run spring
# commands, but it is necessary for "spring status" and "spring stop"
# to work properly.
# pid: host
# pid: host

View file

@ -23,16 +23,15 @@ upstream puma {
#}
# HTTP -> HTTPS redirect
#server {
# listen *:STAGING_PORT;
# server_name $STAGING_DOMAIN;
# return 301 https://$STAGING_DOMAIN$request_uri;
#}
server {
listen *:$STAGING_PORT;
# server_name $STAGING_DOMAIN;
return 301 https://$STAGING_DOMAIN$request_uri;
}
server {
listen *:$STAGING_PORT default_server;
## SSL disabled for now
# listen *:STAGING_PORT_SSL ssl default_server;
#listen *:$STAGING_PORT default_server;
listen *:$STAGING_PORT_SSL ssl default_server;
## domain_agnostic staging
# server_name $STAGING_DOMAIN;
@ -44,8 +43,8 @@ server {
# auth_basic "Staging Area";
# auth_basic_user_file "/etc/nginx/conf.d/.htpasswd_staging";
# ssl_certificate /etc/ssl/certs/ensl_fullchain.pem;
# ssl_certificate_key /etc/ssl/private/ensl_privkey.pem;
ssl_certificate /etc/ssl/ensl/fullchain.pem;
ssl_certificate_key /etc/ssl/ensl/privkey.pem;
# ssl-cert /etc/ssl/certs/ssl-cert-snakeoil.pem
# ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key
@ -90,4 +89,4 @@ server {
}
try_files $uri/index.html $uri @puma;
}
}