0
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?

Nginx のインストールおよび関連コマンド

Posted at

公式ダウンロードページ

Nginx のダウンロード

  1. wget を使ってダウンロード
cd /usr/local/src

wget https://nginx.org/download/nginx-1.24.0.tar.gz
  1. 圧縮ファイルを解凍
tar -zxvf nginx-1.24.0.tar.gz
  1. コンパイルとインストール
// Nginx の解凍ディレクトリに移動
cd nginx-1.24.0 

// コンパイル前の設定と依存チェック
./configure

//コンパイル 
make 

//インストール
make install

もしコンパイル時に次のようなエラーが出た場合:

make: *** No rule to make target build’, needed by default’. Stop.

以下のように解決できます:

// 以下の依存パッケージをインストール
yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel
// 再度 configure(オプション付き)
./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module
// 再コンパイル
make

  1. Nginx を起動
sudo systemctl start nginx

Nginx のコマンド一覧

  • インストール済みか確認
which nginx 
  • バージョン確認
nginx -v
  • Nginx プロセスを確認
ps aux | grep nginx
  • サービスを起動
sudo systemctl start nginx
  • 起動状態を確認
sudo systemctl status nginx
  • Nginx を停止
sudo systemctl stop nginx
  • Nginx を再起動
sudo systemctl restart nginx
  • 設定を再読み込み(サービスを中断せずに)
sudo systemctl reload nginx
0
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
0
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?