I want to setup symfony with nginx and this config is working fine
server {
listen 80;
root /src/web;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# 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;
}
error_log /var/log/nginx/symfony_error.log;
access_log /var/log/nginx/symfony_access.log;
}
However i also want that on my server i should also be able to access files via app_dev.php and app_test.php as well
so far with above config. http://127.0.0.1/api/check
is working fine
but i also want
http://127.0.0.1/app_dev.php/api/check
and http://127.0.0.1/app_test.php/api/check
to work as well.
Currently its gives me 404 error
UPDATE
server {
listen 80;
root /src/web;
client_max_body_size 30m;
client_body_buffer_size 128k;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ \.php {
root /src/web/;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri =404;
}
}