Upgrading Nginx to the latest version on Ubuntu servers

Writing this post after a long long time almost a gap of around 1+ year.

Nginx – I have been a big fan of nginx since the time I came to know about it. Have written many blogs about the same in the past. Most of the apps deployed by me are on Nginx.

Its always good to have nginx upgraded to the latest version. Below are the steps for the same

First of all check the existing version of nginx using

nginx -v

Now take the back of the existing nginx

sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.1.1.19.backup

Now Stop the service

sudo service nginx stop or /etc/init.d/nginx stop

Install dependencies (might not be required)

sudo aptitude install python-software-properties

Add the repository for the stable version of Nginx

sudo add-apt-repository ppa:nginx/stable

Now update and upgrade

sudo aptitude update
sudo aptitude safe-upgrade

Once done. start nginx

sudo service nginx restart or /etc/init.d/nginx start

Again check the version (For confirmation)

nginx -v

Voila!! its done. Njoy safe and secure web apps.

Please post your comments in case you face any issues in upgrading nginx.

Be Sociable, Share!

Leave a Reply

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