This article is provided by the CentOS tutorial column to introduce how to install the latest stable version of Nginx on CentOS 8. I hope it will be helpful to you if you need it!
CentOS 8 Install the latest stable version of Nginx Steps:
1. Delete the old version of Nginx
If you have not installed it before, you can skip it This step.
Stop Nginx
sudo systemctl stop nginx
Delete the old installed version
sudo dnf remove nginx
2. Install Nginx warehouse
First, install the dnf tool:
sudo dnf install dnf-utils
Use the editor to create a file:
vim /etc/yum.repos.d/nginx.repo
The file content is:
/etc/yum.repos.d/nginx.repo [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 module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
Save and exit.
3. Install the latest version of Nginx
With the nginx.repo added above, dnf can install the latest stable version of Nginx.
Nginx also has a mainline version, which contains some new features. If necessary, you can use the following command to enable it:
sudo yum-config-manager --enable nginx-mainline
For the difference between the stable version and the mainline version, please refer to: https://www .nginx.com/blog/nginx-1-6-1-7-released/
Then you can install it.
sudo dnf -y install nginx
After completion, the latest stable version of Nginx will be installed on the CentOS 8 server.
4. Startup and startup Nginx
Startup:
sudo systemctl start nginx
Startup:
sudo systemctl enable nginx
The above is the detailed content of How to install the latest version of Nginx on CentOS8. For more information, please follow other related articles on the PHP Chinese website!