I'm a newbie with nginx and it's rewrite commands and I really need some help with this one. I've been trying to solve this the whole day but nothing..
If user gives this url:
someurl.com/sub/1.0/healthcheck
I would like to rewrite it to point into the Symfonys project file here:
/var/www/sub/1.0/web/app_dev.php
And the "healthcheck" in the url goes for the Symfony.
But nope. Something is wrong here. It seems that it finds the Symfony but there is something wrong with the url since it always returns:
Route not found
Even if I omit the "healthcheck" from the url, it still returns the same error. (there is an index -action with "/" as the route.)
Here is the current Nginx config:
server {
server_name localhost;
root /var/www/sub/1.0/web;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
location / {
root /var/www/html/;
index index.html;
}
location /sub/1.0/ {
index app_dev.php;
rewrite ^/sub/1.0/ /app_dev.php last;
}
location ~ (app|app_dev).php {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}