LoginSignup
2
1

More than 3 years have passed since last update.

CentOS7 でNginxをインストールする

Posted at

CnetOS7にNginxをインストールする

nginx.repoに追加する

nano /etc/yum.repos.d/nginx.repoコマンドでエディタモードを起動する。
個人的には、初心者は直感的な操作が可能なnanoを使用するといいでしょう。
もし導入していないのであれば、yum -y install nanoを先に実行して、先ほどのコマンドを入力するといいかと思います。

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

[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

あとは、yum -y install nginxとやるだけ...

おまけ

公式サイトによれば安定版ではない、最新版を使いたい場合は、以下のコマンドを実行すればいい。
sudo yum-config-manager --enable nginx-mainline

参考サイト:
Installation instructions to CentOS
CentOSのサポートしているバージョン

Version Supported Platforms
6.x x86_64, i386
7.4+ x86_64, ppc64le
8.x x86_64
2
1
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
2
1