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.

nginx emergency error unknown directive NGINX_REDIRECTS

| 00:00:24 30.09.2020

The combination:

DirectAdmin 1.61.4 to 1.61.5 update is available.
Nginx 1.19.2 to 1.19.3 update is available.

once updated, brings to:

nginx: [emerg] unknown directive "|NGINX_REDIRECTS|" in /usr/local/directadmin/data/users/admin/nginx.conf:32
nginx: configuration file /etc/nginx/nginx.conf test failed

The new release of the control might have a bug, or templates shipped with the version are outdated.

Here is a quick patch for fixing it.

Custom templates for NGINX

Do you have custom templates? Check whether or not you have files:

  • /usr/local/directadmin/data/templates/custom/nginx_server.conf 
  • /usr/local/directadmin/data/templates/custom/nginx_server_secure.conf

If the files exist you will need to modify them.

You don't need to create them if you don't have them.

Default templates for NGINX

In case you don't have custom templates you will deal with the default templates, which can be found under

  • /usr/local/directadmin/data/templates/nginx_server.conf 
  • /usr/local/directadmin/data/templates/nginx_server_secure.conf

So now open either custom or default templates and add the following line:

|?NGINX_REDIRECTS=|

into the files and save them.

And then run the following command:

/usr/local/directadmin/custombuild/build rewrite_confs

It should fix the issue, you might control it with the following way:

nginx -t

You should see something like this:

[root@server custom]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@server custom]#
That's it.
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