安装Nginx 1.14到CentOS 8(通过AppStream)

首先

使用Application Stream(AppStream)在CentOS8上安装Nginx1.14。
参考:RHEL8的软件包结构-BaseOS和Application Stream-红帽工程师博客。

支持

根据我们使用的方法,根据《Red Hat Enterprise Linux 8 Application Streams Life Cycle – Red Hat Customer Portal》,预计2021年5月将到达终止支持(EOL)。
此后可能不会对报告的漏洞或问题进行修复。

记录

安装

# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)

# yum install -y @nginx:1.14
... 略

启动/关闭nginx

# systemctl start nginx
# systemctl status -l nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/nginx.service.d
           mqphp-fpm.conf
   Active: active (running) since Thu 2019-09-26 06:35:24 EDT; 1min 5s ago
  Process: 7819 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 7817 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 7815 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 7820 (nginx)
    Tasks: 3 (limit: 11109)
   Memory: 7.0M
   CGroup: /system.slice/nginx.service
           tq7820 nginx: master process /usr/sbin/nginx
           tq7821 nginx: worker process
           mq7822 nginx: worker process

Sep 26 06:35:24 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...
Sep 26 06:35:24 localhost.localdomain nginx[7817]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Sep 26 06:35:24 localhost.localdomain nginx[7817]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Sep 26 06:35:24 localhost.localdomain systemd[1]: Started The nginx HTTP and reverse proxy server.
# systemctl stop nginx
# systemctl status -l nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/nginx.service.d
           mqphp-fpm.conf
   Active: inactive (dead)

Sep 26 06:33:48 localhost.localdomain systemd[1]: Started The nginx HTTP and reverse proxy server.
Sep 26 06:33:50 localhost.localdomain systemd[1]: Stopping The nginx HTTP and reverse proxy server...
Sep 26 06:33:50 localhost.localdomain systemd[1]: Stopped The nginx HTTP and reverse proxy server.
Sep 26 06:34:59 localhost.localdomain systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.
Sep 26 06:35:24 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server...
Sep 26 06:35:24 localhost.localdomain nginx[7817]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Sep 26 06:35:24 localhost.localdomain nginx[7817]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Sep 26 06:35:24 localhost.localdomain systemd[1]: Started The nginx HTTP and reverse proxy server.
Sep 26 06:36:54 localhost.localdomain systemd[1]: Stopping The nginx HTTP and reverse proxy server...
Sep 26 06:36:54 localhost.localdomain systemd[1]: Stopped The nginx HTTP and reverse proxy server.

Nginx自动启动及设置取消。

# systemctl enable nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

# systemctl list-unit-files --type=service |grep nginx
nginx.service                               enabled
# systemctl disable nginx
Removed /etc/systemd/system/multi-user.target.wants/nginx.service.

# systemctl list-unit-files --type=service |grep nginx
nginx.service                               disabled

各种确认 – gè

# which nginx
/usr/sbin/nginx

# nginx -v
nginx version: nginx/1.14.1

# yum module info @nginx:1.14
Last metadata expiration check: 0:44:15 ago on Thu 26 Sep 2019 05:58:05 AM EDT.
Unable to resolve argument @nginx:1.14
Error: No matching Modules to list
[root@localhost ~]# yum module info nginx:1.14
Last metadata expiration check: 0:44:20 ago on Thu 26 Sep 2019 05:58:05 AM EDT.
Name             : nginx
Stream           : 1.14 [d][e][a]
Version          : 8000020190628020724
Context          : 55190bc5
Profiles         : common [d] [i]
Default profiles : common
Repo             : AppStream
Summary          : nginx webserver
Description      : nginx 1.14 webserver module
Artifacts        : nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.src
                 : nginx-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-all-modules-1:1.14.1-8.module_el8.0.0+5+258f653c.noarch
                 : nginx-debuginfo-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-debugsource-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-filesystem-1:1.14.1-8.module_el8.0.0+5+258f653c.noarch
                 : nginx-mod-http-image-filter-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-http-image-filter-debuginfo-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-http-perl-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-http-perl-debuginfo-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-http-xslt-filter-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-http-xslt-filter-debuginfo-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-mail-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-mail-debuginfo-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-stream-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64
                 : nginx-mod-stream-debuginfo-1:1.14.1-8.module_el8.0.0+5+258f653c.x86_64

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive]
广告
将在 10 秒后关闭
bannerAds