栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Centos 利用yum源安装 nginx 1.20.1

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Centos 利用yum源安装 nginx 1.20.1

环境
  • CentOS 7.9 (腾讯云服务器)
  • nginx 1.20.1
yum源说明

腾讯云的 CentOS 服务器,用的是腾讯的yum源镜像。
感兴趣的可以去/etc/yum.repos.d中看看。

yum源提供nginx 1.20.1的安装了
shell> yum info nginx
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
Installed Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.20.1
Release     : 9.el7
Size        : 1.7 M
Repo        : installed
From repo   : epel
Summary     : A high performance web server and reverse proxy server
URL         : https://nginx.org
License     : BSD
Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
            : IMAP protocols, with a strong focus on high concurrency, performance and low
            : memory usage.
安装nginx
shell> yum install -y nginx
  • -y : 不需要询问我,自动安装
检查nginx是否安装
shell> nginx -v
nginx version: nginx/1.20.1
启动nginx
shell> systemctl start nginx
查看nginx是否已启动
shell> systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2021-11-06 11:59:58 CST; 2h 38min ago
  Process: 25017 ExecReload=/usr/sbin/nginx -s reload (code=exited, status=0/SUCCESS)
 Main PID: 3407 (nginx)
   CGroup: /system.slice/nginx.service
           ├─ 3407 nginx: master process /usr/sbin/nginx
           ├─25018 nginx: worker process
           ├─25019 nginx: worker process
           ├─25020 nginx: worker process
           └─25021 nginx: worker process

Nov 06 11:59:58 VM-16-8-centos systemd[1]: Starting The nginx HTTP and reverse proxy server...
Nov 06 11:59:58 VM-16-8-centos nginx[3403]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Nov 06 11:59:58 VM-16-8-centos nginx[3403]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Nov 06 11:59:58 VM-16-8-centos systemd[1]: Started The nginx HTTP and reverse proxy server.
Nov 06 14:24:58 VM-16-8-centos systemd[1]: Reloading The nginx HTTP and reverse proxy server.
Nov 06 14:24:58 VM-16-8-centos systemd[1]: Reloaded The nginx HTTP and reverse proxy server.

或者

shell> ps -ef | grep nginx
root      3407     1  0 11:59 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx    25018  3407  0 14:24 ?        00:00:00 nginx: worker process
nginx    25019  3407  0 14:24 ?        00:00:00 nginx: worker process
nginx    25020  3407  0 14:24 ?        00:00:00 nginx: worker process
nginx    25021  3407  0 14:24 ?        00:00:00 nginx: worker process
root     26944 18502  0 14:38 pts/1    00:00:00 grep --color=auto nginx

6,查看80端口返回的内容

shell> curl localhost:80


...

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/451141.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号