【Nginx】Nginx ~ 環境構築編 ~

 【1】Nginx

* 読み方 : エンジンエックス
* フリーのWebサーバ
Items Apache Nginx
Pros1 動作が安定している 同時接続の処理能力が高い
Pros2 拡張機能が多い 高速で処理できる
Cons1 同時接続が増えると負荷が掛かる 拡張機能が少ない
Cons2 - ロシア産

 【2】環境構築

 1)設定環境

* OS : CentOS7
* Nginx : V 1.10.3

 2)準備

別のWebサーバ / Apache が動いている場合

# 動いているか確認
systemctl status httpd.service
# 「Active: active (running)」が表示

# 停止
systemctl stop httpd.service

# 自動起動OFF
systemctl disable  httpd.service

# 自動起動OFFになったか確認
systemctl is-enabled  httpd.service
# 「disabled」が表示

3)設定手順

[1] yum リポジトリを登録する

sudo rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

[2] Nginx をインストールする

sudo yum install nginx

[3] Nginx を開始する

systemctl start nginx.service

[4] 確認を行う

# [4-1] バージョン確認
~~~~
nginx -v
~~~~

# [4-2] ブラウザで「http://localhost/」にアクセスする
# 「Welcome to nginx!」が表示されればOK

http://localhost/

[5] 自動起動ON

systemctl enable nginx.service

[6] 自動起動ONを確認

systemctl is-enabled nginx.service
# 「enabled」が表示

 【3】各種ファイルの場所

 1)設定ファイル

/etc/nginx/nginx.conf

/etc/nginx/conf.d/default.conf

 2)ログファイル

/var/log/nginx/access.log

/var/log/nginx/error.log

 3)ディレクト

/usr/share/nginx/html

 【4】補足:商用 NGINX Plus

* 商用のNGINX Plusってのもあって、機能比較は以下のURLを参照のこと。

http://sios.jp/products/oss/nginx/products/

 参考文献

http://www.atmarkit.co.jp/ait/articles/1406/17/news013.html
インストール
http://weblabo.oscasierra.net/install-nginx-1/
http://www.atmarkit.co.jp/ait/articles/1407/24/news003_2.html

関連記事

Nginx ~ ロードバランシング ~
https://dk521123.hatenablog.com/entry/2017/03/01/230523