Compare commits

...

8 Commits

Author SHA1 Message Date
Yurii Izorkin
506111c611
Merge 9a6187c9e9 into c442589593 2025-07-10 08:04:32 +00:00
Izorkin
9a6187c9e9
nginx: remove try_files directive
There is no need to use the try_files directive in every location. In addition,
it causes unnecessary system calls.
2025-06-24 22:03:56 +03:00
Izorkin
4eea7d3e76
nginx: remove unused header
Headers are not used in the streaming block.
2025-06-24 21:55:17 +03:00
Izorkin
9820803dfa
nginx: renaming @proxy block to @mastodon
If multiple sites are hosted on server, a common `@proxy` block
name may cause a conflict if another site uses a block with
same name.
2025-06-24 21:55:17 +03:00
Izorkin
bf4d970c7d
nginx: move processing of remaining static files to main location block 2025-06-24 21:55:16 +03:00
Izorkin
56712dea99
nginx: add new location block 2025-06-24 21:55:16 +03:00
Izorkin
5a26ac75cd
nginx: remove unused location block 2025-06-24 21:55:16 +03:00
Izorkin
3ef634eebc
nginx: remove regexp function from location block
In PR 19438, there was an error in way location
blocks was handled.
2025-06-24 21:55:11 +03:00

40
dist/nginx.conf vendored
View File

@ -66,65 +66,53 @@ server {
gzip_static on;
location / {
try_files $uri @proxy;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri @mastodon;
}
# If Docker is used for deployment and Rails serves static files,
# then needed must replace line `try_files $uri =404;` with `try_files $uri @proxy;`.
location = /sw.js {
add_header Cache-Control "public, max-age=604800, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
}
location ~ ^/assets/ {
# then needed uncomment line with `try_files $uri @mastodon;`.
location ^~ /assets/ {
add_header Cache-Control "public, max-age=2419200, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
# try_files $uri @mastodon;
}
location ~ ^/avatars/ {
location ^~ /avatars/ {
add_header Cache-Control "public, max-age=2419200, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
}
location ~ ^/emoji/ {
location ^~ /emoji/ {
add_header Cache-Control "public, max-age=2419200, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
}
location ~ ^/headers/ {
location ^~ /headers/ {
add_header Cache-Control "public, max-age=2419200, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
}
location ~ ^/packs/ {
location ^~ /ocr/ {
add_header Cache-Control "public, max-age=2419200, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
}
location ~ ^/shortcuts/ {
location ^~ /packs/ {
add_header Cache-Control "public, max-age=2419200, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
}
location ~ ^/sounds/ {
location ^~ /sounds/ {
add_header Cache-Control "public, max-age=2419200, must-revalidate";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
try_files $uri =404;
}
location ~ ^/system/ {
location ^~ /system/ {
add_header Cache-Control "public, max-age=2419200, immutable";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
add_header X-Content-Type-Options nosniff;
add_header Content-Security-Policy "default-src 'none'; form-action 'none'";
try_files $uri =404;
}
location ^~ /api/v1/streaming {
@ -141,12 +129,10 @@ server {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
tcp_nodelay on;
}
location @proxy {
location @mastodon {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;