From 735b55904f3eb8d2ade5abd6d5f2f5454a0ccf79 Mon Sep 17 00:00:00 2001 From: b1ek Date: Tue, 6 Jun 2023 18:32:32 +1000 Subject: [PATCH] serve static files over nginx --- config/nginx/nginx.conf | 12 ++++++++++++ docker-compose.dev | 1 + docker-compose.prod | 1 + 3 files changed, 14 insertions(+) diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf index ba54f50..e858187 100644 --- a/config/nginx/nginx.conf +++ b/config/nginx/nginx.conf @@ -22,10 +22,22 @@ http { tcp_nopush on; server_names_hash_bucket_size 128; # this seems to be required for some vhosts + gzip on; + gzip_types text/plain application/json application/x-json application/javascript application/x-javascript text/css text/x-css; + gzip_min_length 1024; + gzip_static on; + server { listen 80; location / { proxy_pass http://server; } + location /static { + root /var/www; + gzip_static on; + } + location /announce.json/ { + root /var/www; + } } } \ No newline at end of file diff --git a/docker-compose.dev b/docker-compose.dev index c543023..390fe27 100644 --- a/docker-compose.dev +++ b/docker-compose.dev @@ -28,6 +28,7 @@ services: - homepage volumes: - './config/nginx:/etc/nginx' + - './public:/var/www:ro' db: image: postgres:alpine ports: diff --git a/docker-compose.prod b/docker-compose.prod index b6fa1c6..437dc67 100644 --- a/docker-compose.prod +++ b/docker-compose.prod @@ -25,6 +25,7 @@ services: - homepage volumes: - './config/nginx:/etc/nginx' + - './public:/var/www:ro' db: restart: always image: postgres:alpine