move rewrite rule to inside location, remove root directive

This commit is contained in:
Boudewijn 2025-03-02 18:59:29 +01:00
parent a8d41f6af5
commit fb517aff32

View file

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