インストール

公式に従い,インストール.

  1. yum install yum-utils
  2. /etc/yum.repos.d/nginx.repoを次の通り作成.
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
  1. yum-config-manager --enable nginx-mainline
  2. yum -y install nginx

起動

ファイアウォールは予めhttpを通しておく.

systemctl start nginxで有効化する.

エラー

systemctl start nginxしたら,次のような形式のエラーメッセージが出た.

Problem 1: conflicting requests
- nothing provides module(perl:5.26) needed by module
perl-DBD-MySQL:4.046:8010020191114030811:073fa5fe-0.x86_64
Problem 2: conflicting requests
- nothing provides module(perl:5.26) needed by module
perl-DBI:1.641:8010020191113222731:16b3ab4d-0.x86_64

これは,インストールしていたperlバージョン5.26を次で適用して解決できた.

yum module enable perl:5.26

有効化できることを確認し,

systemctl enable nginx

で自動起動するようにした.