CentOS7 YUM 安装NGINX

时间:2023-05-22 15:29:44

1.先添加源:

 nano /etc/yum.repos.d/nginx.repo
把下边这段代码添加到nginx.repo中去。
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=1
enabled=1

2.添加签名:

 wget: http://nginx.org/keys/nginx_signing.key
sudo rpm --import nginx_signing.key

3.更新源:

 sudo yum update

4.安装:

 sudo yum install nginx

5.启动:

nginx  #启动

#  nginx -s quit/reload/reopen/stop
# quit – Shut down gracefully
# reload – Reload the configuration file
# reopen – Reopen log files
# stop – Shut down immediately (fast shutdown)

完成:

浏览器中输入服务器地址(本机:127.0.0.1)显示如下:

CentOS7 YUM 安装NGINX

参考文献:

installing nginx open source: https://www.nginx.com/resources/admin-guide/installing-nginx-open-source/

nginx:linux packages: http://nginx.org/en/linux_packages.html