If you want to use a deployment tool like Capistrano or Laravel Envoy with symbolic linked release directories, instead of mapping your script to the path of the symlink with $document_root
:
location ~ \.php$ {
# ...
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# ...
}
You should instead reference the $realpath_root
variable as this allows for all new requests to immediately be mapped to the new release on deployment.
location ~ \.php$ {
# ...
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# ...
}