title: Nginx Reload Configuration Best Practice
body: <p>Currently setting up a nginx reverse-proxy load-balancing a wide variety of domain names.</p>
  
  <p>nginx configuration files are programatically generated and might change very often (ie add or delete http/https servers)</p>
  
  <p>I am using:</p>
  
  <pre><code>nginx -s reload
  </code></pre>
  
  <p>To tell nginx to re-read the configuration.</p>
  
  <p>the main nginx.conf file contain an include of all the generated configuration files as such:</p>
  
  <pre><code>http {
    include /volumes/config/*/domain.conf;
  }
  </code></pre>
  
  <p>Included configuration file might look like this:</p>
  
  <pre><code>server {
    listen 80;
    listen [::]:80;
    server_name mydomain.com;
    location / {
      try_files $uri /404.html /404.htm =404;
      root /volumes/sites/mydomain;
    }
  }
  </code></pre>
  
  <p><strong>My question:</strong></p>
  
  <p>Is it healthy or considered harmfull to run:</p>
  
  <pre><code>nginx -s reload
  </code></pre>
  
  <p>multiple times per minutes to notify nginx to take into account modifications on the configuration?
  What kind of performance hit would that imply ?</p>
  
  <p>EDIT: <strong>I'd like to reformulate the question: How can we make it possible to dynamically change the configuration of nginx very often without a big perfomance hit ?</strong></p>