How to use yum to install nginx in centos8

PHPz
Release: 2023-05-29 08:37:05
forward
1441 people have browsed it

How to use yum to install nginx in centos8

centos8 Install nginx

yum directly install

centos8 and centos7Installing nginx is a little different. Centos8 comes with nginx 1.14.1. Let’s upgrade to the new stable version 1.20.1 first

Create the repo source file in the etc directory

cd /etc/yum.repos.d 
  touch nginx.repo
Copy after login

Use vim to edit

  vim nginx.repo
Copy after login

2. Copy the following content and save it using :wq

[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

3. Check whether the source has been modified successfully

  yum info nginx
Copy after login

4. Install nginx

  yum install nginx -y
Copy after login

nginx basic commands

Use systemctl global process management, no need to go to sbin to start

# 开启 
systemctl start nginx

#停止
systemctl stop nginx

#重载nginx
systemctl reload nginx
Copy after login

Do not use systemctl, You can start nginx's sbin, and yum is installed in /usr/sbin

#切换到 /usr/sbin
cd /usr/sbin
# 开启 
 ./nginx  

#停止
./nginx -s stop

#重载nginx
./nginx -s reload
Copy after login

View nginx process status

ps -ef |grep nginx
Copy after login

The above is the detailed content of How to use yum to install nginx in centos8. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!