All HowTo's Linux Redhat, Fedora and CentOS Linux Web Servers

Minimal Nginx and PHP-FPM on CentOS

This article explains how to install a minimal Nginx server with php-fpm on a CentOS server.

Install the packages:

yum install nginx php-fpm php

And here is the sample virtual-host config “/etc/nginx/conf.d/”:

server {
        listen 80;
        server_name *;

        access_log   /var/log/nginx/;
        error_log    /var/log/nginx/;

        root /var/www/;
        index index.php;

        location / {
                try_files $uri $uri/ /index.php?$args;

        location ~ .php$ {
                #try_files $uri =404;
                include fastcgi_params;
                include fastcgi.conf;
                fastcgi_index  index.php;

Ensure this line exists in the “/etc/php-fpm.d/www.conf” file. It replaces existing “listen” lines:

listen =

And restart Nginx and PHP.

service nginx restart
service php-fpm restart