CentOS 8にNginx 1.14をインストール（AppStream）

# はじめに

Application Stream(AppStream)を利用してCentOS8にNginx1.14をインストール
親記事：[Nginxの各種インストール方法とEOLまとめ](https://qiita.com/witchcraze/items/df4a0baaaad9c932ea30)
参考：[RHEL8のパッケージ構成 - BaseOSとApplication Stream - 赤帽エンジニアブログ]( https://rheb.hatenablog.com/entry/rhel8_baseos_and_appstream)

## サポート

本手法で導入した場合、[Red Hat Enterprise Linux 8 Application Streams Life Cycle - Red Hat Customer Portal](https://access.redhat.com/node/4079021)より、2021-05がEOLだと思われる。
それ以降に報告された脆弱性や不具合への対応は実施されない可能性がある。

## LOG

### インストール

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

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

### nginx起動/停止

```shell-session
# 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.
```

```shell-session
# 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自動起動設定/設定解除

```shell-session
# 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
```

```shell-session
# systemctl disable nginx
Removed /etc/systemd/system/multi-user.target.wants/nginx.service.

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

### 各種確認

```shell-session
# 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]
```