split nginx into different configs

This commit is contained in:
Masroor Ehsan 2025-01-27 10:57:22 +06:00
parent 4320acfc12
commit b5edddb606
5 changed files with 52 additions and 32 deletions

3
.env
View File

@ -1,7 +1,8 @@
#
# Nginx configuration
#
NGINX_DEFAULT_CONF=./config/ohif/nginx.conf
NGINX_DEFAULT_CONF=./config/ohif/nginx/default.conf
NGINX_OHIF_CONF=./config/ohif/nginx/ohif.conf
#
# OHIF Viewer

View File

@ -1,28 +0,0 @@
server {
listen 80;
# set client body size to 500M, this is to allow uploading of DICOMs, throws '413 request entity too large nginx' error otherwise #
client_max_body_size 500M;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# https://book.orthanc-server.com/faq/nginx.html#nginx
location /orthanc/ {
proxy_pass http://orthanc:8042;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
rewrite /orthanc(.*) $1 break;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
}
}

View File

@ -0,0 +1,5 @@
server {
listen 80;
include /etc/nginx/enabled-sites/*.conf;
client_max_body_size 250M;
}

View File

@ -0,0 +1,32 @@
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
add_header Cross-Origin-Opener-Policy same-origin;
add_header Cross-Origin-Embedder-Policy require-corp;
add_header Cross-Origin-Resource-Policy same-origin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# https://book.orthanc-server.com/faq/nginx.html#nginx
location /orthanc/ {
proxy_pass http://orthanc:8042;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
rewrite /orthanc(.*) $1 break;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
}

View File

@ -16,11 +16,20 @@ services:
volumes:
- ${POSTGRES_DATA_MNT}:${PGDATA}
healthcheck:
test: ["CMD", "pg_isready", "-q", "-d", "${POSTGRES_DB}", "-U", "${POSTGRES_USER}"]
test:
[
"CMD",
"pg_isready",
"-q",
"-d",
"${POSTGRES_DB}",
"-U",
"${POSTGRES_USER}",
]
start_period: 20s
interval: 30s
retries: 5
timeout: 5s
timeout: 5s
restart: unless-stopped
pgadmin:
@ -75,6 +84,7 @@ services:
- APP_CONFIG=/usr/share/nginx/html/app-config.js
volumes:
- ${NGINX_DEFAULT_CONF}:/etc/nginx/conf.d/default.conf:ro
- ${NGINX_OHIF_CONF}:/etc/nginx/enabled-sites/ohif.conf:ro
- ${OHIF_CONFIG}:/usr/share/nginx/html/app-config.js:ro
- ${OHIF_LOGO}:/usr/share/nginx/html/logo.png:ro
restart: unless-stopped
@ -100,4 +110,4 @@ services:
networks:
pacs:
external: true
external: true