Over at the official NGINX docs, they have the following configuration for production-level Symfony:
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
The full configuration file can be found here
What is internal
actually redirecting to? The comments say that it removes the front controller from the URI, but I'm not entirely sure how.
It doesn't redirect anything. It specifies how external redirections, i.e. locations like
http://example.com/app.php/some-path
should be handled; while set, they should return404
, only allowing internal redirections. Conditions handled as internal redirections are listed in the documentation forinternal
directive: