DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for a simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize and support it.

Directadmin: Unable to write customization for NGINX

| 22:51:24 03.04.2017

If Directadmin fails to write customization into NGINX configs with an error: Unable to write customization and details complaining about Too many open files when checking its configuration. That happens due to a system limit on Max open files set  on Directadmin processes.

Check it now

First make sure and check what limit do you have:

for pid in $(pidof directadmin); do grep "^Max open files" /proc/$pid/limits; done;

You should see something similar to the following output:

Max open files            1024                 4096                 files
Max open files            1024                 4096                 files
Max open files            1024                 4096                 files
Max open files            1024                 4096                 files

That's the limit! To relax the limit do the following

On CentOS 7 or Debian 8 with systemd

Historically, resource limits for processes are defined in /etc/security/limits.conf. This file is read at login time for users logging in with PAM (via file However, RHEL 7 system services that are started via systemd do not use PAM for login, so the limits in /etc/security/limits.conf are ignored.

Update section [Service] of the file: /etc/systemd/system/directadmin.service and bring it to the suggested view:

ExecStart=/etc/systemd/scripts/directadmin start
ExecReload=/etc/systemd/scripts/directadmin reload
ExecStop=/etc/systemd/scripts/directadmin stop

Here we added one line: LimitNOFILE=32768. You can change the limit to whatever you need or want.

Now the right time to reload a configuration and restart the daemon with:

systemctl daemon-reload
systemctl restart directadmin

On CentOS 7 or Debian 8 without systemd

At the top of the file /etc/init.d/directadmin, but below the line:



ulimit -HSn 32768

and type:

/etc/init.d/directadmin restart

Earlier versions of OS

You should be fine with modifying PAM limits in /etc/security/limits.d/90-nproc.conf or /etc/security/limits.conf

root       soft    nofile    32768
root       hard    nofile    48000

Re-login and re-start Directadmin.

Am I Successful?

We expect to see something similar to the following:

# for pid in $(pidof directadmin); do grep "^Max open files" /proc/$pid/limits; done;
Max open files            32768                 48000                files
Max open files            32768                 48000                files
Max open files            32768                 48000                files
Max open files            32768                 48000                files

And of course Directadmin should allow us to save customization for NGINX.

Used links:

About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable experience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.

All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition