Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ubuntu: Install Nginx php5-fpm website #PHP #Nginx #Markdown


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


  • Ubuntu server
  • Nginx
  • Nginx minimal website
  • php5-fpm


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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.