You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New site configs are not applied by systemctl reload nginx with the default LimitNOFILE — only a full restart works (downtime for likr 400-500. sites) #831
Adding a site writes the vhost for the new domain and reloads nginx. With the
default LimitNOFILE inherited from systemd (1024 soft), the reload does not
pick up the new configuration: the new site returns 404 / keeps serving the old
config until nginx is fully restarted. A full systemctl restart nginx always
works.
The practical consequence is that the only reliable way to add a site is to
restart nginx, which briefly drops every active connection of every other site
hosted on the server — an outage caused by a routine operation.
Setting LimitNOFILE=500000 through a systemd drop-in makes reload work as
expected, which points at the file-descriptor limit as the root cause. There is
currently no way to set this from the panel, the docs do not mention it, and the
failure is silent: the panel reports the site as created while nginx is still
running the previous configuration.
How to reproduce
Provision a server with CloudPanel defaults, without any systemd override:
systemctl show nginx -p LimitNOFILE
# LimitNOFILE=1024:524288
Add a new site from the panel (or add a server { ... } block manually).
Reload and request the new domain:
systemctl reload nginx
systemctl status nginx
curl -I https://new-site.test
After this drop-in, systemctl reload nginx applies new configuration correctly
and no restart is needed to add a site.
Solution
Ship a higher file-descriptor limit with the nginx package/installer, e.g.
create /etc/systemd/system/nginx.service.d/override.conf containing [Service] and LimitNOFILE=500000, followed by systemctl daemon-reload.
This is backwards compatible and can be done once at install/update time.
Alternatively raise the limit from inside nginx itself by adding worker_rlimit_nofile 500000; to the generated /etc/nginx/nginx.conf, so
the limit no longer depends on the systemd unit.
Make the site create/delete flow verify the result instead of trusting the
reload: run nginx -t before reloading, check the exit code of systemctl reload nginx, and when the reload does not take effect either
retry or surface the error in the panel. A silent "success" while nginx is
still serving the old configuration is what makes this hard to diagnose.
Add a troubleshooting entry in the docs (worker_connections exceed open file resource limit, LimitNOFILE, how to change it), since admins currently
have no hint that the limit exists.
Additional Context
systemctl show nginx -p LimitNOFILE (stock install): <1024:524288>
systemctl show nginx -p LimitNOFILE (after override): <500000>
nginx -V: <output>
Sites on the affected server: <n>
systemctl reload nginx; echo $?: <exit code>
Old worker processes still alive after reload: <yes/no>
Activity