File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,10 +33,13 @@ services:
3333 image : nginx:latest
3434 volumes :
3535 - ./docker/nginx.prod.conf:/etc/nginx/nginx.conf:ro
36+ - ${SSL_CERT_PATH}:/etc/nginx/ssl/certs/fullchain.pem:ro
37+ - ${SSL_KEY_PATH}:/etc/nginx/ssl/certs/privkey.pem:ro
3638 - ${HOST_STATIC_ROOT}:/usr/share/nginx/html/static # website static assets.
3739 - ${HOST_MEDIA_ROOT}:/usr/share/nginx/html/silo # website user-uploaded files.
3840 ports :
39- - " ${EXPOSED_PORT}:80"
41+ - " ${EXPOSED_PORT:-80}:80"
42+ - " ${EXPOSED_SSL_PORT:-443}:443"
4043 depends_on :
4144 - django
4245 networks :
Original file line number Diff line number Diff line change 11user nginx;
2- worker_processes 4 ;
2+ worker_processes auto ;
33error_log /var/log/nginx/error.log warn;
44pid /var/run/nginx.pid;
55
66events {
77 worker_connections 1024;
88}
99
10+
1011http {
12+ upstream django_app {
13+ server django:8000; # The Django app is exposed on the `django` container on port 8000
14+ }
15+
16+ # REDIRECT HTTP -> HTTPS
1117 server {
1218 listen 80 deferred;
1319 client_max_body_size 128M;
1420 server_name cncnet.org mapdb2.cncnet.org;
15-
21+
22+ location / {
23+ return 301 https://$host$request_uri;
24+ }
25+ }
26+
27+ # HTTPS
28+ ssl_session_cache shared:SSL:5m;
29+ ssl_session_timeout 5m;
30+ server {
31+ listen 443 ssl;
32+ client_max_body_size 128M;
33+ server_name cncnet.org mapdb2.cncnet.org;
34+
35+ ssl_certificate /etc/nginx/ssl/certs/fullchain.pem;
36+ ssl_certificate_key /etc/nginx/ssl/certs/privkey.pem;
37+ ssl_protocols TLSv1.2 TLSv1.3;
38+ ssl_ciphers HIGH:!aNULL:!MD5;
39+
1640 # Serve static files: js, static images, etc.
1741 location /static/ {
1842 alias /usr/share/nginx/html/static/; # The nginx container's mounted volume.
2953
3054 # Proxy requests to the Django app running in gunicorn
3155 location / {
32- proxy_pass http://django:8000; # The Django app is exposed on the `django` container on port 8000
56+ proxy_pass http://django_app;
3357 proxy_set_header Host $http_host;
3458 proxy_set_header X-Real-IP $remote_addr;
3559 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Original file line number Diff line number Diff line change @@ -48,3 +48,9 @@ TESTING_API_PASSWORD=
4848
4949# Options are in `kirovy.constants.RunEnvironment`
5050RUN_ENVIRONMENT =
51+
52+ # The port for https connections
53+ # Not necessary for local dev
54+ EXPOSED_SSL_PORT = 443
55+ SSL_CERT_PATH =
56+ SSL_KEY_PATH =
You can’t perform that action at this time.
0 commit comments