I'm trying to setup reverse proxy for my php-fpm. My current configuration almost works, however if there is space in URI, ie /example/api/search/some%20phrase it doesn't work.
This configuration is worked when I was just simply 'redirecting' to php-fpm. Now I need to strip first part of my URI /example/api to just /api and it's broken.
Here is part of my Nginx config:
location ^~ /example/api {
root /app/public;
rewrite ^/example(.*)$ $1 break;
try_files $uri /index.php?$args;
}
location ~ \.php$ {
set $newurl $request_uri;
if ($newurl ~ ^/example(.*)$) {
set $newurl $1;
root /app/public;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 10.171.226.48:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REQUEST_URI $newurl;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}