From 6c992cade5f03b4b6c3602ded2d186cf55d73728 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 4 Dec 2023 08:18:45 +0100 Subject: [PATCH] docs(nginx): improve nginx configuration Remove etag off and improve Cache-Control Signed-off-by: Thomas Citharel --- support/nginx/mobilizon-release.conf | 17 +++++------------ support/nginx/mobilizon-source.conf | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/support/nginx/mobilizon-release.conf b/support/nginx/mobilizon-release.conf index f074c3544..11c661b08 100644 --- a/support/nginx/mobilizon-release.conf +++ b/support/nginx/mobilizon-release.conf @@ -66,6 +66,8 @@ server { location / { + expires off; + add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always; proxy_pass http://localhost:4000; } @@ -75,24 +77,15 @@ server { default_type "text/plain"; } - location ~ ^/img { + location ~ ^/(assets|img) { root /opt/mobilizon/priv/static; - etag off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; - } - - location ~ ^/(js|css) { - root /opt/mobilizon/priv/static; - etag off; - access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; } location ~ ^/(media|proxy) { - etag off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; proxy_pass http://localhost:4000; } diff --git a/support/nginx/mobilizon-source.conf b/support/nginx/mobilizon-source.conf index ff626e197..03ed6979f 100644 --- a/support/nginx/mobilizon-source.conf +++ b/support/nginx/mobilizon-source.conf @@ -66,6 +66,8 @@ server { location / { + expires off; + add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always; proxy_pass http://localhost:4000; } @@ -75,24 +77,15 @@ server { default_type "text/plain"; } - location ~ ^/img { + location ~ ^/(assets|img) { root /opt/mobilizon/priv/static; - etag off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; - } - - location ~ ^/(js|css) { - root /home/mobilizon/live/priv/static; - etag off; - access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; } location ~ ^/(media|proxy) { - etag off; access_log off; - add_header Cache-Control "public, max-age=31536000, immutable"; + add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable"; proxy_pass http://localhost:4000; }