Tente esta configuração (não testei, mas espero que faça o que você quer).
server {
root /var/www/homeserver/public;
location /dev {
allow 127.0.0.1;
deny all;
rewrite ^/dev/(.*)$ /$1 break;
try_files $uri $uri/ /index.php$is_args$args;
location ~* [^/]\.php(/|$) {
gzip off;
expires off; ## Do not cache dynamic content
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404 "Error 404 Not found. (err#002)";
}
include fastcgi_params;
fastcgi_param APP_ENV dev;
fastcgi_index index.php;
fastcgi_param HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param SCRIPT_FILENAME $request_filename;
# fastcgi_param DOCUMENT_ROOT $realpath_root; # DOCUMENT_ROOT already specified in fastcgi_params
}
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
location ~* [^/]\.php(/|$) {
gzip off;
expires off; ## Do not cache dynamic content
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404 "Error 404 Not found. (err#001)";
}
include fastcgi_params;
fastcgi_param APP_ENV prod;
fastcgi_index index.php;
fastcgi_param HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param SCRIPT_FILENAME $request_filename;
# fastcgi_param DOCUMENT_ROOT $realpath_root; # DOCUMENT_ROOT already specified in fastcgi_params
}
}
}