How to install the latest version of Nginx on CentOS8

藏色散人
Release: 2021-12-30 17:14:20
forward
2319 people have browsed it

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
Copy after login

Delete the old installed version

sudo dnf remove nginx
Copy after login

2. Install Nginx warehouse

First, install the dnf tool:

sudo dnf install dnf-utils
Copy after login

Use the editor to create a file:

vim /etc/yum.repos.d/nginx.repo
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

Startup:

sudo systemctl enable nginx
Copy after login

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!

Related labels:
source:awaimai.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template