I've this configuration:
server {
server_name app.local;
index index.php;
location /api/v1 {
alias /app/api/v1/code;
try_files $uri /api/v1/index.php$is_args$args;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass api-v1-php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
}
Removing the outer try_files, it seems to find the index.php, BUT I need to preserve the behavior where every request (e.g. app.local/api/v1/test) are being handled anyway by the index.php. How can I mantain that? Is this a bug?
try_files
andalias
have side-effects, but they are consistent side-effects. That statement is necessary to the function of your website. The statement either works or it doesn't work, you will need to test it. I tend to avoid usingtry_files
withalias
and prefer to useif (!-e $request_filename) { rewrite ^ /api/v1/index.php last; }
- as you already know from the link I gave you on our sister site. – Richard Smith Jan 25 at 11:02try_files
. – Michael Hampton Jan 25 at 11:29