diff --git a/docker-compose.yml b/docker-compose.yml index 8e676f60af9..de6a69f6b6a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,9 +12,12 @@ services: restart: unless-stopped build: . environment: + # TODO: Move all host-depend environments to file .env # Run `docker-compose run web config generate-secret-key` # to get the SENTRY_SECRET_KEY value. # SENTRY_SECRET_KEY: '' + # To enable ssl connections + # SENTRY_URL_PREFIX: 'https://' SENTRY_MEMCACHED_HOST: memcached SENTRY_REDIS_HOST: redis SENTRY_POSTGRES_HOST: postgres @@ -48,6 +51,9 @@ services: - web ports: - "0.0.0.0:80:80" + - "0.0.0.0:443:443" + volumes: + - /etc/letsencrypt:/etc/letsencrypt web: restart: unless-stopped diff --git a/nginx/nginx.conf b/nginx/nginx.conf index b59446e06f4..c082b4c17f5 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -4,13 +4,28 @@ upstream web { server { listen 80; + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl; + ssl_certificate /etc/letsencrypt/live/sentry.fosanis.de/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/sentry.fosanis.de/privkey.pem; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; + # Enable HSTS + add_header Strict-Transport-Security "max-age=31536000"; + charset utf-8; location / { try_files $uri @proxy_to_web; } + location @proxy_to_web { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://web; diff --git a/sentry.conf.py b/sentry.conf.py index e4e0baf1842..6e85ca529c2 100644 --- a/sentry.conf.py +++ b/sentry.conf.py @@ -71,6 +71,7 @@ }, } +SENTRY_URL_PREFIX = env('SENTRY_URL_PREFIX') # You should not change this setting after your database has been created # unless you have altered all schemas first SENTRY_USE_BIG_INTS = True