I want to configure a symfony project on internal directory of existing site.

so I have a directory on the server /home/mysymfonyproj/ which has the symfony project and the folder web

and I have my site in /home/mysite/ dir

nginx has been configured to server my site from /home/mystie dir,

now I want to add a location that every call to www.mysite.com/api/mynewstaff

will go to symfony dir.

I was able to achieve this with

location ~* ^/(app_dev.php/api/mynewstaff|api/mynewstaff)/ { alias /home/mysymfonyproj/web rewrite ^/api/mynewstaff/(.*) /$1 break;


but I can't figure out how to include the try_files $uri /app.php$is_args$args; directive that will take the URL and move it to app.php$.... so symfony can process it.

to forward it to another location like

location ~ ^/app.php(/|$) { } that will send it correctly to the php handler.

Is it possible to configure nginx and symfony this way ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.