How to restart nginx on OS X

后端 未结 13 1038
无人共我
无人共我 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:28

    To reload config files:

    sudo nginx -s reload
    

    To fully restart nginx:

    sudo nginx -s quit
    sudo nginx
    

    Details

    There is no restart signal for nginx. From the docs, here are the signals that the master process accepts:

    SIGINT, SIGTERM  Shut down quickly.
    SIGHUP           Reload configuration, start the new worker process with a new configuration, and gracefully shut down old worker processes.
    SIGQUIT          Shut down gracefully.
    SIGUSR1          Reopen log files.
    SIGUSR2          Upgrade the nginx executable on the fly.
    SIGWINCH         Shut down worker processes gracefully.
    

    Presumably you could send these signals to the process id manually, but the nginx command has the flag nginx -s that sends signals to the master process for you. Your options are:

    stop    SIGTERM
    quit    SIGQUIT
    reopen  SIGUSR1
    reload  SIGHUP
    

    No need to futz with the pid manually.


    Edit: just realized much of this info was already in comments on the other answers. Leaving this here anyway to summarize the situation.

提交回复
热议问题