LoginSignup
1
2

More than 3 years have passed since last update.

CentOS に nginx をインストールする

Posted at

CentOS に nginx をインストールする、メモ。

cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)

リポジトリ追加

/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
ls -l /etc/yum.repos.d/
-rw-r--r--. 1 root root  100 Dec 24 01:53 nginx.repo

インストール

yum info nginx
yum install nginx

起動設定と開始

systemctl enable nginx
systemctl start nginx
systemctl status nginx

ファイアウォール ← ここ忘れる。

firewall-cmd --add-service=http --zone=public --permanent
firewall-cmd --reload

場所 説明
/etc/nginx/ Nginx の設定ファイルが保存されているディレクトリ
/etc/nginx/nginx.conf メインとなる設定ファイル
/var/log/nignx/ Nginx のログが保存されるディレクトリ
/usr/share/nginx/html/ WEBサイトの公開ディレクトリ
1
2
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
2