web-base/docker/nginx/site.conf

64 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-04-07 19:43:22 +02:00
server {
2021-12-08 16:53:43 +01:00
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /application;
2023-01-25 14:15:34 +01:00
client_max_body_size 1G;
2021-12-08 16:53:43 +01:00
2022-06-01 09:47:31 +02:00
# rewrite error codes
error_page 400 /index.php?error=400;
error_page 403 /index.php?error=403;
error_page 404 /index.php?error=404;
error_page 500 /index.php?error=500;
2021-12-08 16:53:43 +01:00
# rewrite api
2022-06-01 11:20:24 +02:00
rewrite ^/(api(/.*)?)$ /index.php?api=$1;
2021-12-08 16:53:43 +01:00
# deny access to .gitignore / .htaccess
2022-02-20 16:53:26 +01:00
location ~ /\.(?!well-known).* {
2021-12-08 16:53:43 +01:00
rewrite ^(.*)$ /index.php?site=$1;
}
# deny access to docker-compose.yml
location /docker-compose.yml {
rewrite ^(.*)$ /index.php?site=$1;
}
2022-12-01 11:01:49 +01:00
# but allow access to react/dist
location ~ ^/react/dist/.*$ {
add_header "Cache-Control" "max-age=0; must-revalidate";
try_files $uri $uri @redirectToIndex;
}
2021-12-08 16:53:43 +01:00
# deny access to specific directories
location ~ ^/(files/uploaded|react|docker|Site|Core|test)/.*$ {
2021-12-08 16:53:43 +01:00
rewrite ^(.*)$ /index.php?site=$1;
}
# caching
location ~ ^/(static|js|css)/.*$ {
add_header "Cache-Control" "max-age=0; must-revalidate";
2021-04-07 19:43:22 +02:00
}
2021-12-08 16:53:43 +01:00
# try to find the specified file
location / {
try_files $uri $uri @redirectToIndex;
}
# redirect to index.php
location @redirectToIndex {
rewrite ^(.*)$ /index.php?site=$1;
}
# serve .php files
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
2024-03-24 17:36:16 +01:00
fastcgi_pass webbase-php:9000;
2021-12-08 16:53:43 +01:00
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
2021-04-07 19:43:22 +02:00
}