1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

CentOS 8にNginx 1.16をインストール(AppStream)

Last updated at Posted at 2020-01-18

はじめに

Application Stream(AppStream)を利用してCentOS8にNginx1.16をインストール
親記事:Nginxの各種インストール方法とEOLまとめ
参考:RHEL8のパッケージ構成 - BaseOSとApplication Stream - 赤帽エンジニアブログ

サポート

本手法で導入した場合、Red Hat Enterprise Linux 8 Application Streams Life Cycle - Red Hat Customer Portalより、2021-11がEOLだと思われる。→ RHEL8.6リリース後に2021-10に変更された。
それ以降に報告された脆弱性や不具合への対応は実施されない可能性がある。

LOG

インストール

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

# yum install -y @nginx:1.16/common
... 略

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)
   Active: active (running) since Sat 2020-01-18 07:20:34 UTC; 4s ago
  Process: 254 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 253 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 252 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 255 (nginx)
    Tasks: 2 (limit: 8989)
   Memory: 4.0M
   CGroup: /docker/71c622f375ec7840d3e5a10d45673562fa3d2f4b52cc51a58cd2b95103d6af08/system.slice/nginx.service
           tq255 nginx: master process /usr/sbin/nginx
           mq256 nginx: worker process

Jan 18 07:20:34 71c622f375ec systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 18 07:20:34 71c622f375ec nginx[253]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jan 18 07:20:34 71c622f375ec nginx[253]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jan 18 07:20:34 71c622f375ec systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid>
Jan 18 07:20:34 71c622f375ec 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)
   Active: inactive (dead)

Jan 18 07:18:30 71c622f375ec systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.
Jan 18 07:18:30 71c622f375ec systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.
Jan 18 07:18:31 71c622f375ec systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.
Jan 18 07:20:34 71c622f375ec systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jan 18 07:20:34 71c622f375ec nginx[253]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Jan 18 07:20:34 71c622f375ec nginx[253]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Jan 18 07:20:34 71c622f375ec systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid>
Jan 18 07:20:34 71c622f375ec systemd[1]: Started The nginx HTTP and reverse proxy server.
Jan 18 07:21:00 71c622f375ec systemd[1]: Stopping The nginx HTTP and reverse proxy server...
Jan 18 07:21:00 71c622f375ec 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

各種確認

# which nginx
/usr/sbin/nginx

# nginx -v
nginx version: nginx/1.16.1

# yum module info nginx:1.16
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:05:57 ago on Sat Jan 18 07:16:33 2020.
Name         : nginx
Stream       : 1.16 [e] [a]
Version      : 8010020191122190044
Context      : cdc1202b
Architecture : x86_64
Profiles     : common [i]
Repo         : AppStream
Summary      : nginx webserver
Description  : nginx 1.16 webserver module
Artifacts    : nginx-1:1.16.1-1.module_el8.1.0+250+351caf85.src
             : nginx-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-all-modules-1:1.16.1-1.module_el8.1.0+250+351caf85.noarch
             : nginx-debuginfo-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-debugsource-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-filesystem-1:1.16.1-1.module_el8.1.0+250+351caf85.noarch
             : nginx-mod-http-image-filter-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-http-image-filter-debuginfo-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-http-perl-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-http-perl-debuginfo-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-http-xslt-filter-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-http-xslt-filter-debuginfo-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-mail-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-mail-debuginfo-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-stream-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64
             : nginx-mod-stream-debuginfo-1:1.16.1-1.module_el8.1.0+250+351caf85.x86_64

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?