diff --git a/.env.example b/.env.example index 39ebc57..753bead 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,7 @@ SECRET_KEY= # Long, secure, secret string. DATA=./data/ ## Flask Mail Configuration -MAIL_SERVER=ref_test_postfix # Must match name of the Docker service +MAIL_SERVER=postfix # Must match name of the Docker service MAIL_PORT=25 MAIL_USE_TLS=False MAIL_USE_SSL=False diff --git a/docker-compose.yml b/docker-compose.yml index 1412d95..a2873c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.9' services: - ref_test_server: + nginx: container_name: ref_test_server image: nginx:alpine volumes: @@ -21,7 +21,7 @@ services: - ref_test_app command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" - ref_test_app: + app: container_name: ref_test_app image: reftest build: ./ref-test @@ -38,7 +38,7 @@ services: depends_on: - ref_test_postfix - ref_test_postfix: + postfix: container_name: ref_test_postfix image: catatnight/postfix:latest restart: unless-stopped @@ -49,7 +49,7 @@ services: networks: - backend - ref_test_certbot: + certbot: container_name: ref_test_certbot image: certbot/certbot volumes: diff --git a/init-letsencrypt.sh b/install-script.sh similarity index 100% rename from init-letsencrypt.sh rename to install-script.sh diff --git a/nginx/conf.d/ref-test-app.conf b/nginx/conf.d/ref-test-app.conf index 763df59..7aa37ed 100644 --- a/nginx/conf.d/ref-test-app.conf +++ b/nginx/conf.d/ref-test-app.conf @@ -1,5 +1,5 @@ upstream reftest { - server ref_test_app:5000; + server app:5000; } server { @@ -15,7 +15,7 @@ server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; - #SSL configuration + # SSL configuration include /etc/nginx/ssl.conf; include /etc/nginx/certbot-challenge.conf; @@ -33,4 +33,25 @@ server { include /etc/nginx/conf.d/common-location.conf; proxy_pass http://reftest; } +} + +server { + server_name www.domain_name; + listen 80; + listen [::]:80; + # Redirect to non-www + return 301 $scheme://example.com$request_uri; +} + +server { + server_name www.domain_name; + listen 443 ssl http2; + listen [::]:443 ssl http2; + + # SSL configuration + include /etc/nginx/ssl.conf; + include /etc/nginx/certbot-challenge.conf; + + # Redirect to non-www + return 301 $scheme://example.com$request_uri; } \ No newline at end of file