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:


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



Add this Nginx configuration to your website config.



    # 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

Leave a Reply

Back to Top
%d bloggers like this: