Today Nginx version 1.9.1 was released and this brief tutorial is going to show you how to install or upgrade to it in Ubuntu/CentOS 7. Nginx is a great web server and is being used by millions of webmasters across the Internet to manage and power their websites or blogs.
We do use Nginx on this site as well. We started off with Apache2, but quickly switch to Nginx after experiencing some unexplained issues with Apache2.. We uninstalled Apache2, installed and configured Nginx, and our site has been stabled since.
Most will argue that the two servers are great. Maybe few will slightly give Nginx a small edge over Apache2. My experience is Nginx helped us where Apache2 failed. It might just be that I didn’t configure Apache2 correctly and that was why it failed on my site.
That can be argued.
For those who wish to install Nginx as their webserver can continue below to learn how to install or upgrade to the latest version in either Ubuntu or CentOS 7. For those who have chosen Apache2, can also just read and learn. This guide will come in handy for new users as well.
Here’s what you’ll find the new release;
- a change to disable SSLv3 by default
- some long deprecated directives are not supported anymore
- the “reuseport” parameter of the “listen” directive.
- a fix that for Nginx that might fail to start on some old Linux variants; the bug had appeared in 1.7.11.
and other changes.
If you update your servers but didn’t get updates for Nginx, it might just mean that you have a stable version of Nginx’s repository installed. In order to get the latest version of Nginx, you must install Nginx mainline repositories for your systems.
To install Nginx’s mainline repository in CentOS 7, run commands below to create a Nginx’s repository on your system
sudo vi /etc/yum.repos.d/nginx.repo
Then copy and paste the lines below into the file and save it.
To install Nginx’s mainline repository in Ubuntu, run the command below to obtain Nginx repository authentication key
cd /tmp/ && wget http://nginx.org/keys/nginx_signing.key
Then run the commands below to install or add the key to your system
sudo apt-key add nginx_signing.key
Next, run the commands below to create Nginx’s repository on your system
sudo vi /etc/apt/sources.list.d/nginx.list
Finally, add the lines below into the file and save it.
deb http://nginx.org/packages/mainline/ubuntu/ codename nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ codename nginx
replace codename with the codename of your Ubuntu system (ex. Ubuntu 14.10 is known as Utopic)
After that, run the commands below to install Nginx on Ubuntu
sudo apt-get update && sudo apt-get install nginx
To install Nginx CentOS 7 after adding the new repository, run the commands below.
sudo yum update && sudo yum install nginx
That’s how you install the latest version of Nginx on Ubuntu or CentOS 7.