Analysis of Nginx installation examples under CentOS

PHPz
Release: 2023-05-11 20:28:11
forward
870 people have browsed it

Installation environment: linux server centos 7.3, root permissions

1, install the prerequisites:

sudo yum install yum-utils

2 , to set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

(Note to replace the os version: $releasever, for example, the centos version is 7, Replace it with 7)

Command:

Use vim to edit the nginx.repo file

vim /etc/yum.repos.d/nginx.repo

Set the yum source of nginx:

Paste the following content into the nginx.repo file

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

Enter the vim command: wq Save and exit

3. To install nginx, run the following command:

sudo yum install nginx
You will enter y to confirm the installation

4.When prompted to accept the gpg key, verify that the fingerprint matches 573b fd6b 3d8f bc64 1079 a6ab abf5 bd82 7bd9 bf62, and if so, accept it.

Finally, the fingerprint will be output. If it matches the red part above, enter y again to confirm

5. Start | Stop | Restart nginx:

# 启动
systemctl start nginx.service

# 停止
systemctl stop nginx.service

# 重启
systemctl restart nginx.service
Copy after login

6. View all installation locations of nginx:

rpm is the rpm package management tool for Linux, -q represents query mode, -l represents return list

rpm -ql nginx

7. nginx configuration file:

/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
Copy after login

The above is the detailed content of Analysis of Nginx installation examples under CentOS. 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!