Setting Up PHP

If you have CGI or other script content, such as a website written in PHP like WordPress or Drupal, you have more work to do. While the ability to serve PHP is available by default in Nginx (it didn’t use to be), it still requires additional setup. This section will add the ability to serve PHP content to our existing Nginx server. As a result, there are some PHP-specific parts to this process. They should be obvious.

First, we need to make sure PHP is installed on the server. There are many ways to do this. For this example, we will use PHP-FPM, which you can learn more about at

To do this, install the following packages: php5-cli, php5-cgi, psmisc, spawn-fcgi, and php5-fpm.

Edit the file /etc/php5/fpm/pool.d/www.conf ...

Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.