Today I’ll go over the steps of how to get PHP-FPM and Nginx working together on Ubuntu 10.10. I used this article as my starting point and made some minor modifications of my own.
To start with I used a clean version of Ubuntu 10.10 (Desktop). Adjust if needed for Ubuntu Server but the steps should really work the same with the exception you most likely won’t be running a browser on Ubuntu Server.
The first step is to update and install Aptitude if you don’t have it already. From there I’ll install Nginx and get it running.
$ sudo apt-get update $ sudo apt-get install aptitude $ sudo aptitude install nginx $ sudo /etc/init.d/nginx start
Open a browser to this address and verify Nginx is working.
Next I’ll install PHP-FPM:
$ sudo aptitude install php5-fpm
Note: The configuration file for Nginx is located at: /etc/nginx/nginx.conf
Now we need to edit the vhost file:
$ sudo pico /etc/nginx/sites-available/default
Use the following screenshots to see what I’ve done.
…and modify it to look like this (remove the comment blocks, add a space between include and the fastcgi_params, add in the /var/www)

Save the file and exit pico (or whatever editor your using).
Next we can add some PHP modules (modify as you wish) and create an info.php file to test with.
$ sudo aptitude install php5-cgi php5-dev php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ps php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-xsl php5-common php5-mysql $ sudo pico /var/www/info.php
The contents of php.info as as follows:
<?php phpinfo(); ?>
Restart Nginx and PHP-FPM:
$ sudo /etc/init.d/nginx restart $ sudo /etc/init.d/php5-fpm restart
Load the info.php file located here.








Pingback: Install Nginx with PHP 5.3.3 (PHP-FPM) on Ubuntu 10.10
thank you thank you best of yes is
Thanks so much for this! I’d tried several other walkthroughs, and none of them worked for me. Turns out the part that was missing in the others was the fastcgi_param setting.
Good and simple tutorial! However, let me point out that you could simply use this line, instead of harcoding the absolute path:
$document_root$fastcgi_script_name
Cheers ; )
@Frederic,
Thanks!
Chad
Pingback: Submit a JQuery Mobile form via AJAX with PHP | Giant Flying Saucer
fastcgi_index is only used when request URI ends with slash. Which will never be the case in location ~ \.php$