pidとは何か
Process IDの略。
psコマンドで見ることができるプロセスに割り当てられる整数の通し番号こと。
pidファイルはメインプロセスのプロセスIDが書き込まれるファイルを示す。
プロセスID(PID)とは - IT用語辞典 e-Words
Nginxにおけるpidディレクティブ
メインプロセスのプロセスIDが書き込まれるpidファイルを示すディレクティブ。
コンパイル時のデフォルトの値を上書きします。
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