Day: August 7, 2009

  • Gracefully restart Nginx

    Follow these 3 steps to gracefully stop and start Nginx without losing any queries. It works like a charm.

    1. Test new configuration is correct
      nginx -t
    2. Find the Pid
      ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'
    3. And kill it. Meanwhile, new configuration is already effective.
      kill -HUP ????
      (replace ???? with the Pid given in step 2)