1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moncycle_ynh.git synced 2024-09-03 19:46:16 +02:00
moncycle_ynh/conf/nginx.conf
2024-02-21 00:19:46 +07:00

50 lines
1.2 KiB
Nginx Configuration File

#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source
alias __INSTALL_DIR__/;
# Deny access to hidden files and directories
location ~ ^/(.+/|)\.(?!well-known\/) {
deny all;
}
# Deny access to script folder
location ~ ^/(script/.+)\.(.+) {
deny all;
}
# Prevent useless logs
location ~ ^/favicon.ico {
log_not_found off;
access_log off;
}
location ~ ^/robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/api/version {
rewrite ^/api/version$ /api/version.json;
}
# Default indexes and catch-all
rewrite ^/(connexion|compte)$ /$1.php;
rewrite ^/api/([a-zA-Z0-9_]+)(\?.*)?$ /api/$1.php$2;
index index.php index.html;
try_files $uri $uri/ $uri.php?$args;
# Execute and serve PHP files
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}