[NGINX](http://nginx.org) is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and the most important, web server. NGINX uses PHP-FPM to process PHP files.

Official NGINX ppa is available for Ubuntu that installs the latest stable version of NGINX available for the specific version Ubuntu on your system is running.

If you are running Ubuntu Server (Ubuntu desktop build already comes with this package).

sudo apt-get install software-properties-common

Adding NGINX ppa to your system

sudo apt-add repository ppa:nginx/stable

Updating your local package manager database.

sudo apt-get update

Installing NGINX

sudo apt-get install nginx-full

Installing PHP-FPM (NGINX will process php files).

sudo apt-get install php5-fpm

Add the following lines to your nginx config “/etc/nginx/sites-enabled/default`.`

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;`

Now we can start PHP5-FPM`.

sudo /etc/init.d/php5-fpm start

Now you can create an index.php file in /usr/share/nginx/html/ to test your web server configuration and add the lines below to it.




Now you have NGINX installed on your Ubuntu powered system. If you have any problem feel free to leave a comment below.

Darryl Dias

I’m Darryl. I’m a 3D Generalist, Web Developer and Linux enthusiast. On this site I share my insights, tips and tricks, tutorials, methods and best practices.

Leave a comment

Your email address will not be published. Required fields are marked *