tools-compose/nginx.conf.template

102 lines
2.6 KiB
Plaintext

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name ${TOOLS_HOSTNAME};
index index.php index.html;
root /www;
# Redirect old path to newer ones
rewrite ^/SH4compatibility/(.*)$ $scheme://$http_host/SH4compatibilityTool/$1 permanent;
rewrite ^/fxi2g1r/(.*)$ $scheme://$http_host/G1rFxiTools/FXItoG1R/$1 permanent;
rewrite ^/G1MtoG1R/(.*)$ $scheme://$http_host/G1rFxiTools/G1MtoG1R/$1 permanent;
rewrite ^/PicViewer/(.*)$ $scheme://$http_host/G1rFxiTools/PicViewer/$1 permanent;
rewrite ^/festivalgo/(.*)$ $scheme://$http_host/FestivAlgo/$1 permanent;
# Tools homepage
rewrite ^(/_system/.*)$ /home/$1;
rewrite ^/?$ /home/index.php;
# Forward to the main php-fpm container
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm-main:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
server {
listen 80;
listen [::]:80;
server_name ${WIKI_HOSTNAME};
index index.php;
root /www/wiki;
client_max_body_size 5m;
client_body_timeout 60;
# Redirect old path to newer ones
rewrite ^/tools/(.*)$ https://tools.planet-casio.com/$1;
# Priority to the fr part
location = / {
rewrite ^/$ /fr/ permanent;
}
# Redireg to each langages
location /fr/ {
try_files $uri $uri/ @rewrite;
}
location /en/ {
try_files $uri $uri/ @rewrite;
}
# Single file entrypoint
location @rewrite {
rewrite ^/(fr|en)/(.*)$ /$1/index.php?title=$2&$args;
}
# Forbid direct access to cache and maintenance files
location ^~ /(fr|en)/cache/ {
deny all;
}
location ^~ /(fr|en)/maintenance/ {
deny all;
}
# Forward to php-fpm
location ~ \.php$ {
expires off;
fastcgi_param PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm-wiki:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Cache configuration for assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
try_files $uri @rewrite;
expires max;
log_not_found off;
}
# ?
location = /_.gif {
expires max;
empty_gif;
}
}