feat: custom nginx configuration for static deployments + fix 404 redirects in nginx conf

This commit is contained in:
Andras Bacsai
2024-11-11 14:37:19 +01:00
parent 17d61e6f9e
commit b379e50d90
7 changed files with 130 additions and 36 deletions

View File

@@ -4062,3 +4062,31 @@ function isEmailRateLimited(string $limiterKey, int $decaySeconds = 3600, ?calla
return $rateLimited;
}
function defaultNginxConfiguration(): string
{
return 'server {
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/index.html =404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
error_page 404 = @handle_404;
location @handle_404 {
root /usr/share/nginx/html;
try_files /404.html @redirect_to_index;
internal;
}
location @redirect_to_index {
return 302 /;
}
}';
}