This article will guide you to install the latest Nginx in CentOS 6.10.
Although CentOS 7 came out for a while, but still quite a lot of people using CentOS 6.
Install the latest Nginx in CentOS 6
Table of Contents
You only need to follow the steps in this article, I am sure that you will install Nginx latest successfully.
First, we update the OS and install the required package.
yum update && yum install yum-utils -y
Next, use the following command to create a new file named /etc/yum.repos.d/nginx.repo
.
yum install nano -y && nano /etc/yum.repos.d/nginx.repo
Then, copy the content below into the file and save it.
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
And finally, run the following command to install the latest Nginx.
Recommended Reading: How to install latest Nginx in CentOS 7
yum install nginx -y
Check and start Nginx
After the installation is complete, type the following command to check its version.
nginx -v
Then, you use the following command to enable and start the Nginx service.
chkconfig nginx on && service nginx start
And now you can use Nginx in your server.
Conclusion
The article has guided you step by step to install the latest Nginx in your server. Your job now is to start learning how to configure virtualhost and put your website source on the server.
(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).