From fb517aff32487680f9732d7b7271db6cb613a61f Mon Sep 17 00:00:00 2001 From: Boudewijn Date: Sun, 2 Mar 2025 18:59:29 +0100 Subject: [PATCH] move rewrite rule to inside location, remove root directive --- conf/nginx.conf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index fd65f72..9325dd3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,3 @@ -# try redirecting stuff to index.php -rewrite ^(.*)$ /index.php$1 last; -root __INSTALL_DIR__/public/; - location / { alias __INSTALL_DIR__/public/; @@ -12,6 +8,8 @@ location / { try_files $uri $uri/ /index.php?$query_string; location ~ [^/]\.php(/|$) { + # try redirecting stuff to index.php + rewrite ^(.*)$ /index.php$1 last; fastcgi_split_path_info ^(.+\.php)(/.+)$; #fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm.sock; @@ -28,5 +26,6 @@ location / { } # not tested; it may have trouble redirecting location /api/ { + alias __INSTALL_DIR__/public/; try_files $uri $uri/ /api/index.php?$query_string; }