やりたいこと
Nginxが動作しているサーバにて設定されているConfigを表示したい。
環境情報
$ nginx -v nginx version: nginx/1.19.9
やり方
nginxコマンドのTオプションを利用する。以下を押下すると
$ nginx -T
標準出力に現在読み込まれている値が表示される。
# configuration file /etc/nginx/nginx.conf: # Configuration checksum: ... # setup custom paths that do not require root access pid /tmp/nginx.pid; daemon off; ....
以下、補足です。
補足
tオプションではコンフィグの正常性を確認するだけですがTオプションではそれを表示します。
$ nginx -h ... Options: -t : test configuration and exit -T : test configuration, dump it and exit
同コマンドは設定変更の前後で差分を取る場合に重宝します。尚、Tオプションは設定量によっては数千行となるので画面表示する際はお気をつけください。
$ nginx -T | wc ... 2028 4628 62768
以上です。