ScaleScaleScaleScale

Tips / Nginx


How to install Nginx on Ubuntu Linux

Ubuntu is one of the most popular Linux distributions out there, thanks to Canonical and all his crew, we can enjoy a simple ready to go Linux system without previous *nix knowledge. And even we don’t use it, we know lot of people do it, that’s why today I will tell you how to install nginx on ubuntu linux.

First, install nginx package using apt-get

sudo apt-get install nginx

Start Nginx

sudo service nginx start

Check if it’s working fine

Place your IP address in the browser like this http://your_ip/
If you don’t know your IP, just run the following command to get it:

ifconfig eth0 | grep inet | awk '{ print $2 }'

Once you browse that page, you should see a “Welcome to nginx” message.

Add Nginx to the boot system so once you restart the server it will automatically start.

update-rc.d nginx defaults

All done! You have now sucessfully installed nginx on Ubuntu server

What’s next?

Modify the default nginx virtual host file editing in this way:

sudo nano /etc/nginx/sites-available/default

Reload the server once you are done editing the nginx configuration

sudo service nginx reload
profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking