Hi, All
Can you please extend the Symfony-basic nginx-configuration? Here's the way I configured my environment.
One special way that I wanna share with all other people is the switch between the development- and the production-environment.
In my example it's done by a cookie.
By default you'll access the development-env. But if you've added the cookie "env=prod" you switch to the production-environment. Using this you can easily test both environments by only changing the value of the cookie.
I also use all *.sf2 domains in my local network to be passed to this server (because there's no sf2 top-level-domain). But maybe this is not one of the best practices because if you wanna sign a facebook-app, a paypal-sandbox-account or something like that you have to set up another domain that could pass this validation (copied from the framework FLOW3):
(?:
(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[a-z]{2}|aero|asia|biz|cat|com|edu|coop|gov|info|int|invalid|jobs|localdomain|mil|mobi|museum|name|net|org|pro|tel|travel)|
localhost
)
--> I don't know if the rest of this configuration is some best-practice ... but it works for me. If you have some great improvements - just write.
----------------------------------------------------------------------------------------
server {
root /var/www/$host/web;
set $php_run "app_dev.php";
if ($http_cookie ~* "env=prod(?:;|$)") {
set $php_run "app.php";
}
index $php_run;
server_name *.sf2;
location / {
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite .* /$php_run last;
return 200;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index $php_run;
include fastcgi_params;
}
}
----------------------------------------------------------------------------------------
This configuration is also attached as file.