Getting Symfony 2 to run with Nginx
Friday, April 1, 2011 2:05:00 PM
In my last project i made the decision to replace Apache with Nginx. Part of the reason was its a cheap and easy way to get scalability & performance; just install Nginx, configure the rewrites and you're ready to go. The other, and more important reason was, its fun.
So now i have decided to install Symfony 2 with Nginx and PHP FastCGI. Here's the conf file for the site :
Add this code to your 'sites-enabled' dir, in a new file called 'symfony' (File name doesn't matter to nginx. Its just for you to know which site this is referring to). On my Ubuntu (10.10) system my file resides at :
/etc/nginx/sites-enabled/symfony
On Linux, add an entry for 'symfony' to the '/etc/hosts' file. Ex:
Restart nginx and you're good to go! Access the site at :
So now i have decided to install Symfony 2 with Nginx and PHP FastCGI. Here's the conf file for the site :
server {
listen 80;
server_name symfony;
root /path/to/symfony/web/dir;
location ~* .(php|phtml) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /path/to/symfony/web/dir$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
Add this code to your 'sites-enabled' dir, in a new file called 'symfony' (File name doesn't matter to nginx. Its just for you to know which site this is referring to). On my Ubuntu (10.10) system my file resides at :
/etc/nginx/sites-enabled/symfony
On Linux, add an entry for 'symfony' to the '/etc/hosts' file. Ex:
127.0.0.7 symfony
Restart nginx and you're good to go! Access the site at :
http://symfony/


Anonymous # Wednesday, July 27, 2011 12:08:22 PM
Anonymous # Wednesday, August 10, 2011 12:26:26 PM
Anonymous # Wednesday, August 10, 2011 12:26:50 PM