2
0

More than 3 years have passed since last update.

Nginx pidとは何か

Posted at

pidとは何か

Process IDの略。
psコマンドで見ることができるプロセスに割り当てられる整数の通し番号こと。

pidファイルはメインプロセスのプロセスIDが書き込まれるファイルを示す。

プロセスID(PID)とは - IT用語辞典 e-Words

Nginxにおけるpidディレクティブ

メインプロセスのプロセスIDが書き込まれるpidファイルを示すディレクティブ。
コンパイル時のデフォルトの値を上書きします。

nginx.conf
pid /var/run/nginx.pid

pidファイルにはマスタプロセスのPIDが出力されます。pidディレクティブを指定しなかった場合、コンパイル時に指定したファイルパスが使用されますが、サーバの起動スクリプトやプロセス管理ツールに合わせ、適切なファイルパスを指定しましょう。

コンパイル時に指定しなかった場合、デフォルト値はlogs/nginx.pidです。

Nginxのグローバル設定の1つです。
グローバル設定はpid以外にも主要なものとして以下が存在します。

  • user
  • worker_processes
  • error_log
  • pid
  • use
  • worker_connections

pid関係のエラー

pidディレクティブの書換えなどで、pidに関するエラーが出ることがあります。

nginx: [error] invalid PID number "" in "/run/nginx.pid" alpine

findコマンド等を使用して、pidが生成されている場所を調べて、configファイルを見直すか、
nginxのプロセスを全部切った上で再起動させると治ることがあるようです。

linux - ERROR : invalid PID number "" in "/run/nginx.pid" - Stack Overflow

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