Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
- NGINX_HTTP_PORT=${HTTP_PORT}
- NGINX_HTTPS_PORT=${HTTPS_PORT}
volumes:
- ./nginx/templates:/etc/nginx/templates
- ${NGINX_TEMPLATE_PATH}:/etc/nginx/templates
- ./static:/code/static
- ${ROI_PATH}:/rois
- ${SSL_KEY}:/ssl/ssl.key:ro
Expand Down
3 changes: 3 additions & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ DOCKER_NETWORK=photic
# Location of SSL certificate files
SSL_CERT=/etc/ssl/example.crt
SSL_KEY=/etc/ssl/example.key

# Folder containing the nginx template to mount inside the docker container (ssl vs non-ssl)
NGINX_TEMPLATE_PATH=./nginx/templates/no-ssl
30 changes: 30 additions & 0 deletions nginx/templates/no-ssl/default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
upstream photic_server {
server web:8000;
}

server {
listen ${NGINX_HTTP_PORT};
listen [::]:${NGINX_HTTP_PORT};
server_name ${NGINX_HOST};

location /static/ {
root /code;
}

location /rois/ {
root /;
}

location / {
proxy_set_header X-Forwarder-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";

if (!-f $request_filename) {
proxy_pass http://photic_server;
break;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ upstream photic_server {
server {
listen ${NGINX_HTTP_PORT};
listen [::]:${NGINX_HTTP_PORT};
listen ${NGINX_HTTPS_PORT} ssl;
server_name ${NGINX_HOST};

return 301 https://$host$request_uri;
}

server {
listen ${NGINX_HTTPS_PORT} default_server ssl;
server_name ${NGINX_HOST};

ssl_certificate /ssl/ssl.cer;
Expand Down