From 75c9367c2ecc988f4b6596b9a95ff7c766158574 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Feb 2025 13:47:54 +0100 Subject: [PATCH] feat: added template nginx conf for sintonia_webapp --- docker-compose.yml | 3 ++ docker/nginx-sintonia.conf.template | 51 +++++++++++++++++++++++++++++ docker/nginx.conf | 2 +- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 docker/nginx-sintonia.conf.template diff --git a/docker-compose.yml b/docker-compose.yml index 088b50560..0f33c53d1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -129,9 +129,12 @@ services: depends_on: - legacy - sintonia-webapp + environment: + - SINTONIA_LARAVEL_PORT=${SINTONIA_LARAVEL_PORT} volumes: - libretime_assets:/var/www/html:ro - libretime_storage:/srv/libretime:ro + - ${SINTONIA_NGINX_CONFIG_FILEPATH:-./nginx-sintonia.conf.template}:/etc/nginx/templates/sintonia.conf.template:ro - ${NGINX_CONFIG_FILEPATH:-./nginx.conf}:/etc/nginx/conf.d/default.conf:ro - sintonia_assets:/var/www/sintonia_webapp diff --git a/docker/nginx-sintonia.conf.template b/docker/nginx-sintonia.conf.template new file mode 100644 index 000000000..9669bb266 --- /dev/null +++ b/docker/nginx-sintonia.conf.template @@ -0,0 +1,51 @@ + +server { + listen ${SINTONIA_LARAVEL_PORT}; + + root /var/www/sintonia_webapp/public; + + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-Content-Type-Options "nosniff"; + + index index.php; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + error_page 404 /index.php; + + location ~ \.php$ { + fastcgi_pass sintonia-webapp:9000; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param SERVER_NAME sitonia; + include fastcgi_params; + } + + location ~ /\.(?!well-known).* { + deny all; + } + + # Internal path for serving media files from the API. + location /api/_media { + internal; + # This alias path must match the 'storage.path' configuration field. + alias /srv/libretime; + } + + location ~ ^/api/(v2|browser) { + proxy_set_header Host $http_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 $scheme; + + proxy_redirect off; + proxy_pass http://api:9001; + } + +} \ No newline at end of file diff --git a/docker/nginx.conf b/docker/nginx.conf index ce30fa59a..b756f57ec 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -47,4 +47,4 @@ server { # This alias path must match the 'storage.path' configuration field. alias /srv/libretime; } -} +} \ No newline at end of file