Janik von Rotz


1 min read

Install Nginx php5-fpm website

This post is part of my Your own Virtual Private Server hosting solution project.
Get the latest version of this article here: https://gist.github.com/9445746.

Introduction

This is a minimal Nginx configuration to run php based websites/ applications.

Requirements

Installation

Add this Nginx configuration to your website config.

server{

    ...
    
    # php5-fpm configuration
    location ~ \.php$ {
        
        set $php_root /var/www/[host];
        
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }
}

Test config and reload Nginx service.

sudo nginx -t && sudo service nginx reload

Categories: Web server
Tags: application , nginx , php , php5
Improve this page
Show statistic for this page