#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; } }