:::: MENU ::::

Install Nginx with PHP-FPM on CentOS 6

What is Nginx?

Nginx (pronounced “engine x”) is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption.

What is PHP-FPM?

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.

Install the EPEL x86_64 YUM Repository

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Install Nginx

Install PHP and PHP-FPM

Configure Nginx and PHP-FPM

Edit the www.conf pool and comment out the listen on TCP socket and add a unix socket listen = /var/run/php5-fpm.sock

Create a Nginx config file based on your individual site. Below is a config file specific to WordPress running the W3 Total Cache plugin. Note the fastcgi_pass is the same as the unix socket specified in the php-fpm www.conf pool.

Don’t forget to create your log directory if you’re not using the defualt.

Check your configuration for any errors.

Enable php-fpm and Nginx at startup.

Start php-fpm and Nginx.


  • Chris

    will it work with apache?

  • GeorgeRushby

    I am unsure what exactly you’re asking? Nginx is a web server.

    Or are you looking for a why to get php-fpm working with Apache?

  • Rejoan

    Hi, My nginx is showing version 1.0.15, but want to upgrade it to nginx 1.6.2. How to do that? my centOS is 6.5