<div dir="ltr">Hi,<br><br>I have an nginx setup as a reverse proxy into a large number of Rails and Java applications. As it&#39;s a very dynamic system, nginx incudes a whole directory of conf files, one for each application.<br>
<br>nginx works really well, but now that we have about 320 different config files nginx stopped responding to kill -HUP for reloading the conf files. It just ignores the request and nothing happens. My test shows that at 247 files it stop responding to HUP. Up to that number it&#39;s all ok and HUP works perfectly. The files are all pretty much the same, with this format:<br>
<br><br># Definition of the different compute instances we proxy into<br>upstream redmine_nginx {<br>&nbsp; server <a href="http://10.252.179.143:5150">10.252.179.143:5150</a>;&nbsp; <br>}<br><br># vhost definition for this application<br>
server {<br>&nbsp; listen 80;<br>&nbsp; client_max_body_size 10M;<br>&nbsp; client_body_buffer_size 128k;<br>&nbsp; server_name <a href="http://redmine.morphexchange.com">redmine.morphexchange.com</a> ; # Add the redirected domains here (like: <a href="http://www.gadgets.com">www.gadgets.com</a> that is redirected to <a href="http://gadgets.mex.com">gadgets.mex.com</a>)<br>
&nbsp; set $original_uri $uri;<br>&nbsp; access_log /mnt/nginx/logs/redmine/access.log main;<br>&nbsp; error_log&nbsp; /mnt/nginx/logs/redmine/error.log warn;<br>&nbsp; location ~* ^.*/(themes|stylesheets|javascripts|images)(/.*$|$) {<br>&nbsp;&nbsp;&nbsp; proxy_pass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://redmine_nginx">http://redmine_nginx</a>;<br>
&nbsp;&nbsp;&nbsp; proxy_set_header&nbsp; X-Real-IP&nbsp; $http_x_source_address;<br>&nbsp;&nbsp;&nbsp; proxy_set_header Host $host;<br>&nbsp; }<br>&nbsp; location / {<br>&nbsp;&nbsp;&nbsp; proxy_set_header&nbsp; X-Real-IP&nbsp; $http_x_source_address;<br>&nbsp;&nbsp;&nbsp; proxy_intercept_errors&nbsp; on;<br>&nbsp;&nbsp;&nbsp; proxy_set_header Host $host;<br>
&nbsp;&nbsp;&nbsp; error_page&nbsp; 400 401 403 404 414 500 501 502 503 504 505 506 507 508 509 510&nbsp; =&nbsp; @rails_redmine;<br>&nbsp;&nbsp;&nbsp; if ($request_method = POST ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://redmine_nginx">http://redmine_nginx</a>;<br>
&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if ($is_args = &quot;?&quot; ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxy_pass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://redmine_nginx">http://redmine_nginx</a>;<br>&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; }<br>&nbsp; location @rails_redmine {<br>&nbsp;&nbsp;&nbsp; rewrite (.*) $original_uri break;<br>
&nbsp;&nbsp;&nbsp; proxy_pass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://redmine_nginx">http://redmine_nginx</a>;<br>&nbsp;&nbsp;&nbsp; proxy_set_header&nbsp; X-Real-IP&nbsp; $http_x_source_address;<br>&nbsp;&nbsp;&nbsp; proxy_set_header Host $host;<br>&nbsp;&nbsp; }<br>}<br><br>I also tried to increase the server hash size and bucket size but it didn&#39;t help.<br>
<br>Looking at the code, there are a lot of conditions that might result in HUP failing, but those are not logged. Any idea what might be causing this? The same config with less files has no problem with the HUP signal.<br clear="all">
<br><br>Regards,<br><br>Guy Naor.<br><br>-- <br>Guy Naor<br>CTO<br>Morph Labs, Inc.<br><a href="mailto:guy@mor.ph">guy@mor.ph</a><br><a href="http://www.morphexchange.com">www.morphexchange.com</a><br>
</div>