FAQ

Page Discussion Edit History

RuCommandLine

(Redirected from NginxRuCommandLine)

[edit] 袩邪褉邪屑械褌褉褘 泻芯屑邪薪写薪芯泄 褋褌褉芯泻懈 nginx

nginx 锌芯写写械褉卸懈胁邪械褌 褋谢械写褍褞褖懈械 锌邪褉邪屑械褌褉褘:

  • -c <褎邪泄谢> 鈥 褍泻邪蟹褘胁邪械褌 懈褋锌芯谢褜蟹芯胁邪褌褜 泻芯薪褎懈谐褍褉邪褑懈芯薪薪褘泄 褎邪泄谢 <褎邪泄谢> 胁屑械褋褌芯 褎邪泄谢邪 锌芯 褍屑芯谢褔邪薪懈褞.
  • -t 鈥 褌械褋褌懈褉芯胁邪褌褜 泻芯薪褎懈谐褍褉邪褑懈褞. nginx 锌褉芯胁械褉褟械褌 褋懈薪褌邪泻褋懈褔械褋泻褍褞 锌褉邪胁懈谢褜薪芯褋褌褜 泻芯薪褎懈谐褍褉邪褑懈懈, 邪 蟹邪褌械屑 锌褘褌邪械褌褋褟 芯褌泻褉褘褌褜 褎邪泄谢褘, 芯锌懈褋邪薪薪褘械 胁 泻芯薪褎懈谐褍褉邪褑懈懈.


[edit] 校锌褉邪胁谢械薪懈械 nginx

校锌褉邪胁谢褟褌褜 nginx 屑芯卸薪芯 褋 锌芯屑芯褖褜褞 褋懈谐薪邪谢芯胁. 袧芯屑械褉 谐谢邪胁薪芯谐芯 锌褉芯褑械褋褋邪 锌芯 褍屑芯谢褔邪薪懈褞 蟹邪锌懈褋褘胁邪械褌褋褟 胁 褎邪泄谢 /usr/local/nginx/logs/nginx.pid. 袠蟹屑械薪懈褌褜 懈屑褟 褝褌芯谐芯 褎邪泄谢邪 屑芯卸薪芯 锌褉懈 泻芯薪褎懈谐褍褉邪褑懈懈 褋斜芯褉泻懈 懈谢懈 卸械 胁 nginx.conf 写懈褉械泻褌懈胁芯泄 pid. 袚谢邪胁薪褘泄 锌褉芯褑械褋褋 锌芯写写械褉卸懈胁邪械褌 褋谢械写褍褞褖懈械 褋懈谐薪邪谢褘:

  • TERM, INT 斜褘褋褌褉芯械 蟹邪胁械褉褕械薪懈械
  • QUIT 锌谢邪胁薪芯械 蟹邪胁械褉褕械薪懈械
  • HUP 懈蟹屑械薪械薪懈械 泻芯薪褎懈谐褍褉邪褑懈懈, 蟹邪锌褍褋泻 薪芯胁褘褏 褉邪斜芯褔懈褏 锌褉芯褑械褋褋芯胁 褋 薪芯胁芯泄 泻芯薪褎懈谐褍褉邪褑懈械泄, 锌谢邪胁薪芯械 蟹邪胁械褉褕械薪懈械 褋褌邪褉褘褏 褉邪斜芯褔懈褏 锌褉芯褑械褋褋芯胁
  • USR1 锌械褉械芯褌泻褉褘褌懈械 谢芯谐-褎邪泄谢芯胁
  • USR2 芯斜薪芯胁谢械薪懈械 懈褋锌芯谢薪褟械屑芯谐芯 褎邪泄谢邪
  • WINCH 锌谢邪胁薪芯械 蟹邪胁械褉褕械薪懈械 褉邪斜芯褔懈褏 锌褉芯褑械褋褋芯胁

校锌褉邪胁谢褟褌褜 褉邪斜芯褔懈屑懈 锌褉芯褑械褋褋邪屑懈 锌芯 芯褌写械谢褜薪芯褋褌懈 薪械 薪褍卸薪芯. 孝械屑 薪械 屑械薪械械, 芯薪懈 褌芯卸械 锌芯写写械褉卸懈胁邪褞褌 薪械泻芯褌芯褉褘械 褋懈谐薪邪谢褘:

  • TERM, INT 斜褘褋褌褉芯械 蟹邪胁械褉褕械薪懈械
  • QUIT 锌谢邪胁薪芯械 蟹邪胁械褉褕械薪懈械
  • USR1 锌械褉械芯褌泻褉褘褌懈械 谢芯谐-褎邪泄谢芯胁

袠蟹屑械薪械薪懈械 泻芯薪褎懈谐褍褉邪褑懈懈

袛谢褟 褌芯谐芯, 褔褌芯斜褘 nginx 锌械褉械褔懈褌邪谢 褎邪泄谢 泻芯薪褎懈谐褍褉邪褑懈懈, 薪褍卸薪芯 锌芯褋谢邪褌褜 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍 褋懈谐薪邪谢 HUP. 袚谢邪胁薪褘泄 锌褉芯褑械褋褋 褋薪邪褔邪谢邪 锌褉芯胁械褉褟械褌 褋懈薪褌邪泻褋懈褔械褋泻褍褞 锌褉邪胁懈谢褜薪芯褋褌褜 泻芯薪褎懈谐褍褉邪褑懈懈, 邪 蟹邪褌械屑 锌褘褌邪械褌褋褟 锌褉懈屑械薪懈褌褜 薪芯胁褍褞 泻芯薪褎懈谐褍褉邪褑懈褞, 褌芯 械褋褌褜, 芯褌泻褉褘褌褜 谢芯谐-褎邪泄谢褘 懈 薪芯胁褘械 listen 褋芯泻械褌褘. 袝褋谢懈 械屑褍 褝褌芯 薪械 褍写邪褢褌褋褟, 褌芯 芯薪 芯褌泻邪褌褘胁邪械褌 懈蟹屑械薪械薪懈褟 懈 锌褉芯写芯谢卸邪械褌 褉邪斜芯褌邪褌褜 褋芯 褋褌邪褉芯泄 泻芯薪褎懈谐褍褉邪褑懈械泄. 袝褋谢懈 卸械 褍写邪褢褌褋褟, 褌芯 芯薪 蟹邪锌褍褋泻邪械褌 薪芯胁褘械 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘, 邪 褋褌邪褉褘屑 褕谢褢褌 褋芯芯斜褖械薪懈械 芯 锌谢邪胁薪芯屑 胁褘褏芯写械. 小褌邪褉褘械 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘 蟹邪泻褉褘胁邪褞褌 listen 褋芯泻械褌褘 懈 锌褉芯写芯谢卸邪褞褌 芯斜褋谢褍卸懈胁邪褌褜 褋褌邪褉褘褏 泻谢懈械薪褌芯胁. 袩芯褋谢械 芯斜褋谢褍卸懈胁邪薪懈褟 胁褋械褏 泻谢懈械薪褌芯胁 褋褌邪褉褘械 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘 蟹邪胁械褉褕邪褞褌褋褟.

袩褉械写锌芯谢芯卸懈屑, 薪邪 FreeBSD 4.x 泻芯屑邪薪写邪

: ps ax -o pid,ppid,user,%cpu,vsz,wchan,command | egrep '(nginx|PID)'

锌芯泻邪蟹褘胁邪械褌 锌褉懈屑械褉薪芯 褌邪泻褍褞 泻邪褉褌懈薪褍:

: PID  PPID USER    %CPU   VSZ WCHAN  COMMAND
: 33126     1 root     0.0  1148 pause  nginx: master process /usr/local/nginx/sb
: 33127 33126 nobody   0.0  1380 kqread nginx: worker process (nginx)
: 33128 33126 nobody   0.0  1364 kqread nginx: worker process (nginx)
: 33129 33126 nobody   0.0  1364 kqread nginx: worker process (nginx)

袝褋谢懈 锌芯褋谢邪褌褜 褋懈谐薪邪谢 HUP 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍, 褌芯 泻邪褉褌懈薪邪 屑芯卸械褌 斜褘褌褜 褌邪泻芯泄:

: PID  PPID USER    %CPU   VSZ WCHAN  COMMAND
: 33126     1 root     0.0  1164 pause  nginx: master process /usr/local/nginx/sb
: 33129 33126 nobody   0.0  1380 kqread nginx: worker process is shutting down (n
: 33134 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)
: 33135 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)
: 33136 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)

袨写懈薪 褋褌邪褉褘泄 褉邪斜芯褔懈泄 锌褉芯褑械褋褋 33129 胁褋褢 械褖褢 锌褉芯写芯谢卸邪械褌 褉邪斜芯褌邪褌褜. 袩芯 懈褋褌械褔械薪懈懈 薪械泻芯褌芯褉芯谐芯 胁褉械屑械薪懈 芯薪 蟹邪胁械褉褕邪械褌褋褟:

: PID  PPID USER    %CPU   VSZ WCHAN  COMMAND
: 33126     1 root     0.0  1164 pause  nginx: master process /usr/local/nginx/sb
: 33134 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)
: 33135 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)
: 33136 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)

袪芯褌邪褑懈褟 谢芯谐-褎邪泄谢芯胁

袥芯谐-褎邪泄谢褘 薪褍卸薪芯 锌械褉械懈屑械薪芯胁邪褌褜, 邪 蟹邪褌械屑 锌芯褋谢邪褌褜 褋懈谐薪邪谢 USR1 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍. 袨薪 芯褌泻褉芯械褌 蟹邪薪芯胁芯 胁褋械 褌械泻褍褖懈械 芯褌泻褉褘褌褘械 褎邪泄谢褘 懈 薪邪蟹薪邪褔懈褌 懈屑 胁 泻邪褔械褋褌胁械 胁谢邪写械谢褜褑邪 薪械锌褉懈胁懈谢械谐懈褉芯胁邪薪薪芯谐芯 锌芯谢褜蟹芯胁邪褌械谢褟, 锌芯写 泻芯褌芯褉褘屑 褉邪斜芯褌邪褞褌 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘. 袩芯褋谢械 褍褋锌械褕薪芯谐芯 芯褌泻褉褘褌懈褟 谐谢邪胁薪褘泄 锌褉芯褑械褋褋 蟹邪泻褉褘胁邪械褌 胁褋械 芯褌泻褉褘褌褘械 褎邪泄谢褘 懈 锌芯褋褘谢邪械褌 褋芯芯斜褖械薪懈械 芯 锌械褉械芯褌泻褉褘褌懈懈 褎邪泄谢芯胁 褉邪斜芯褔懈屑 锌褉芯褑械褋褋邪屑. 袨薪懈 褌邪泻卸械 芯褌泻褉褘胁邪褞褌 薪芯胁褘械 褎邪泄谢褘 懈 褋褉邪蟹褍 卸械 蟹邪泻褉褘胁邪褞褌 褋褌邪褉褘械. 袙 褉械蟹褍谢褜褌邪褌械 褋褌邪褉褘械 褎邪泄谢褘 锌褉邪泻褌懈褔械褋泻懈 褋褉邪蟹褍 卸械 谐芯褌芯胁褘 写谢褟 写邪谢褜薪械泄褕械泄 芯斜褉邪斜芯褌泻懈, 薪邪锌褉懈屑械褉, 懈褏 屑芯卸薪芯 褋卸懈屑邪褌褜.

袨斜薪芯胁谢械薪懈械 褋械褉胁械褉邪 薪邪 谢械褌褍

袛谢褟 芯斜薪芯胁谢械薪懈褟 褋械褉胁械褉邪 薪褍卸薪芯 蟹邪锌懈褋邪褌褜 薪邪 屑械褋褌芯 褋褌邪褉芯谐芯 懈褋锌芯谢薪褟械屑芯谐芯 褎邪泄谢邪 薪芯胁褘泄. 袟邪褌械屑 薪褍卸薪芯 锌芯褋谢邪褌褜 褋懈谐薪邪谢 USR2 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍 鈥 芯薪 锌械褉械懈屑械薪褍械褌 褋胁芯泄 褎邪泄谢 褋 薪芯屑械褉芯屑 锌褉芯褑械褋褋邪 胁 褎邪泄谢 褋 褋褍褎褎懈泻褋芯屑 .oldbin, 薪邪锌褉懈屑械褉, /usr/local/nginx/logs/nginx.pid.oldbin, 锌芯褋谢械 褔械谐芯 蟹邪锌褍褋褌懈褌 薪芯胁褘泄 懈褋锌芯谢薪褟械屑褘泄 褎邪泄谢, 邪 褌芯褌 胁 褋胁芯褞 芯褔械褉械写褜 鈥 褋胁芯懈 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘:

: PID  PPID USER    %CPU   VSZ WCHAN  COMMAND
: 33126     1 root     0.0  1164 pause  nginx: master process /usr/local/nginx/sb
: 33134 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)
: 33135 33126 nobody   0.0  1380 kqread nginx: worker process (nginx)
: 33136 33126 nobody   0.0  1368 kqread nginx: worker process (nginx)
: 36264 33126 root     0.0  1148 pause  nginx: master process /usr/local/nginx/sb
: 36265 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)
: 36266 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)
: 36267 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)

孝械锌械褉褜 胁褋械 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘 薪邪褉邪胁薪械 锌褉懈薪懈屑邪褞褌 蟹邪锌褉芯褋褘. 袝褋谢懈 锌芯褋谢邪褌褜 褋懈谐薪邪谢 WINCH 锌械褉胁芯屑褍 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍, 褌芯 芯薪 锌芯褕谢褢褌 褋胁芯懈屑 褉邪斜芯褔懈屑 锌褉芯褑械褋褋邪屑 褋芯芯斜褖械薪懈械 芯 锌谢邪胁薪芯屑 胁褘褏芯写械, 懈 芯薪懈 斜褍写褍褌 锌芯褋褌械锌械薪薪芯 胁褘褏芯写懈褌褜:

: PID  PPID USER    %CPU   VSZ WCHAN  COMMAND
: 33126     1 root     0.0  1164 pause  nginx: master process /usr/local/nginx/sb
: 33135 33126 nobody   0.0  1380 kqread nginx: worker process is shutting down (n
: 36264 33126 root     0.0  1148 pause  nginx: master process /usr/local/nginx/sb
: 36265 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)
: 36266 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)
: 36267 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)

袩褉懈 懈褋锌芯谢褜蟹芯胁邪薪懈懈 屑械褌芯写邪 rtsig 薪芯胁褘械 锌褉芯褑械褋褋褘 屑芯谐褍褌 薪械 锌褉懈薪懈屑邪褌褜 褋芯械写懈薪械薪懈褟 写邪卸械 锌芯褋谢械 褌芯谐芯, 泻邪泻 褋褌邪褉芯屑褍 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍 锌芯褋谢邪薪 褋懈谐薪邪谢 WINCH. 袙 褝褌芯屑 褋谢褍褔邪械 薪芯胁芯屑褍 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍 薪褍卸薪芯 锌芯褋褘谢邪褌褜 褋懈谐薪邪谢 USR1 写芯 褌械褏 锌芯褉, 锌芯泻邪 薪芯胁褘械 锌褉芯褑械褋褋褘 薪械 薪邪褔薪褍褌 锌褉懈薪懈屑邪褌褜 褋芯械写懈薪械薪懈褟.

袩芯 懈褋褌械褔械薪懈懈 胁褉械屑械薪懈 蟹邪锌褉芯褋褘 斜褍写褍褌 芯斜褉邪斜邪褌褘胁邪褌褜 褌芯谢褜泻芯 薪芯胁褘械 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘:

: PID  PPID USER    %CPU   VSZ WCHAN  COMMAND
: 33126     1 root     0.0  1164 pause  nginx: master process /usr/local/nginx/sb
: 36264 33126 root     0.0  1148 pause  nginx: master process /usr/local/nginx/sb
: 36265 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)
: 36266 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)
: 36267 36264 nobody   0.0  1364 kqread nginx: worker process (nginx)

袧褍卸薪芯 蟹邪屑械褌懈褌褜, 褔褌芯 褋褌邪褉褘泄 锌褉芯褑械褋褋 薪械 蟹邪泻褉褘胁邪械褌 褋胁芯懈 listen 褋芯泻械褌褘 懈 锌褉懈 薪械芯斜褏芯写懈屑芯褋褌懈 械屑褍 屑芯卸薪芯 褋泻邪蟹邪褌褜, 褔褌芯斜褘 芯薪 褋薪芯胁邪 蟹邪锌褍褋褌懈谢 褋胁芯懈 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘. 袝褋谢懈 褉邪斜芯褌邪 薪芯胁芯谐芯 懈褋锌芯谢薪褟械屑芯谐芯 褎邪泄谢邪 锌芯 泻邪泻懈屑-褌芯 锌褉懈褔懈薪邪屑 薪械 褍褋褌褉邪懈胁邪械褌, 褌芯 屑芯卸薪芯 褋写械谢邪褌褜 褋谢械写褍褞褖械械:

  • 袩芯褋谢邪褌褜 褋褌邪褉芯屑褍 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍 褋懈谐薪邪谢 HUP. 小褌邪褉褘泄 锌褉芯褑械褋褋, 薪械 锌械褉械褔懈褌褘胁邪褟 泻芯薪褎懈谐褍褉邪褑懈懈, 蟹邪锌褍褋褌懈褌 薪芯胁褘械 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘. 袩芯褋谢械 褝褌芯谐芯 屑芯卸薪芯 锌谢邪胁薪芯 蟹邪胁械褉褕懈褌褜 薪芯胁褘械 锌褉芯褑械褋褋褘, 锌芯褋谢邪胁 懈褏 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍 QUIT.
  • 袩芯褋谢邪褌褜 薪芯胁芯屑褍 谐谢邪胁薪芯屑褍 锌褉芯褑械褋褋褍 褋懈谐薪邪谢 TERM, 芯薪 锌芯褕谢褢褌 褋芯芯斜褖械薪懈械 芯 薪械屑械写谢械薪薪芯屑 胁褘褏芯写械 褉邪斜芯褔懈屑 锌褉芯褑械褋褋邪屑 懈 胁褋械 芯薪懈 锌褉邪泻褌懈褔械褋泻懈 褋褉邪蟹褍 卸械 蟹邪胁械褉褕邪褌褋褟. 袩芯 胁褘褏芯写褍 薪芯胁芯谐芯 谐谢邪胁薪芯谐芯 锌褉芯褑械褋褋邪 褋褌邪褉褘泄 蟹邪锌褍褋褌懈褌 薪芯胁褘械 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘.
  • 袝褋谢懈 卸械 薪芯胁褘械 锌褉芯褑械褋褋褘 薪械 蟹邪胁械褉褕邪褞褌褋褟, 褌芯 薪褍卸薪芯 锌芯褋谢邪褌褜 懈屑 褋懈谐薪邪谢 KILL. 袩芯 胁褘褏芯写褍 薪芯胁芯谐芯 谐谢邪胁薪芯谐芯 锌褉芯褑械褋褋邪 褋褌邪褉褘泄 蟹邪锌褍褋褌懈褌 褋胁芯懈 褉邪斜芯褔懈械 锌褉芯褑械褋褋褘.
袝褋谢懈 薪芯胁褘泄 谐谢邪胁薪褘泄 锌褉芯褑械褋褋 胁褘褏芯写懈褌, 褌芯 褋褌邪褉褘泄 锌褉芯褑械褋褋 褍斜懈褉邪械褌 褋褍褎褎懈泻褋 .oldbin 懈蟹 懈屑械薪懈 褎邪泄谢邪 褋 薪芯屑械褉芯屑 锌褉芯褑械褋褋邪.
袝褋谢懈 卸械 芯斜薪芯胁谢械薪懈械 锌褉芯褕谢芯 褍写邪褔薪芯, 褌芯 褋褌邪褉芯屑褍 锌褉芯褑械褋褋褍 薪褍卸薪芯 锌芯褋谢邪褌褜 褋懈谐薪邪谢 QUIT, 懈 褍 薪邪褋 芯褋褌邪褞褌褋褟 褌芯谢褜泻芯 薪芯胁褘械 锌褉芯褑械褋褋褘:
: PID PPID USER  %CPU VSZ WCHAN COMMAND : 36264 1 root 0.0 1148 pause nginx: master process /usr/local/nginx/sb : 36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) : 36266 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) : 36267 36264 nobody 0.0 1364 kqread nginx: worker process (nginx) :