How to restart nginx on OS X

后端 未结 13 1023
无人共我
无人共我 2021-01-30 04:53

I\'m using nginx on OS X 10.8. Freshly installed nginx but can\'t find a way to restart nginx except kill nginx_pid say kill 64116

相关标签:
13条回答
  • 2021-01-30 05:55

    There is a bug here. Depending on whether nginx is running while you modify/restart apache and/or modify nginx configs it is possible for this file (which is essentially just a process ID pointer) to be destroyed.

    When you attempt to send any signal to nginx like

    nginx -s quit;
    nginx -s stop;
    nginx -s reload;
    

    nginx uses this file to reference the ID of the process to which it needs to send the signal. If the file isn't there the link between the active running process of nginx & the cli app is effectively broken.

    I actually ended up in a state where two nginx processes were running simultaneously so killed both.

    To work around this, you can either Force the termination of existing nginx processes via Activity Monitor (then run nginx & have the cli app create a new nginx.pid file) or if you REALLY need to keep nginx running but want to run nginx -s reload - manually create a file in the /run path called nginx.pid and insert the PID of the currently running nginx processs (obtained via Activity Monitor).

    0 讨论(0)
提交回复
热议问题