Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Nginx under CentOS

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to install Nginx under CentOS. I hope you will get something after reading this article. Let's discuss it together.

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, if the centos version is 7, replace it with 7)

Command:

Use vim to edit nginx.repo files

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

Set the yum source for Nginx:

Paste the following into the nginx.repo file

[nginx-stable] name=nginx stable repobaseurl= http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keymodule_hotfixes=true

Enter the vim command: wq save and exit

3 、 To install nginx, run the following command:

Sudo yum install nginx

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, fingerprint will be output. If it matches the red part above, type y to confirm it.

5. Start | stop | restart Nginx:

# start systemctl start nginx.service#, stop systemctl stop nginx.service# and restart systemctl restart nginx.service

6. View all installation locations of Nginx:

Rpm is linux's rpm package management tool, with-Q for query mode and-l for return list

Rpm-ql nginx

7. Nginx configuration file:

/ etc/nginx/conf.d/etc/nginx/conf.d/default.conf after reading this article, I believe you have a certain understanding of "how to install Nginx under CentOS". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report