Symptoms
- The following error is shown in Plesk:
New configuration files for the Apache web server were not created due to the errors in configuration templates: nginx: [emerg] "worker_rlimit_nofile" directive is duplicate in /etc/nginx/ulimit.global_params:1 nginx: configuration file /etc/nginx/nginx.conf test failed
or
New configuration files for the Apache web server were not created due to the errors in configuration templates: nginx: [emerg] "gzip" directive is duplicate in /etc/nginx/conf.d/nginx.conf:2 nginx: configuration file /etc/nginx/nginx.conf test failed
- It might not be possible to enable nginx support with the error:
# /usr/local/psa/admin/bin/nginxmng -e
nginx: [emerg] "worker_rlimit_nofile" directive is duplicate in /etc/nginx/ulimit.global_params:1 - The nginx configuration test fails:
# nginx -t
nginx: [emerg] "worker_rlimit_nofile" directive is duplicate in /etc/nginx/nginx.conf:45
nginx: configuration file /etc/nginx/nginx.conf test failed - The Nginx directive defined in the error message (I.E.:
worker_rlimit_nofile
orgzip
), is defined in the following configuration files:# grep -r worker_rlimit_nofile /etc/nginx/ | grep -v "#"
/etc/nginx/nginx.conf:worker_rlimit_nofile 20480;
/etc/nginx/ulimit.global_params:worker_rlimit_nofile 65536;
Cause
The
directive returned in the error/s message is defined twice
Nginx
Resolution
-
Connect to the server using SSH .
-
Open the file from the error message in text editor and comment the duplicated directive with "#":
# cat /etc/nginx/nginx.conf
#worker_rlimit_nofile 20480;Note: In the example above the directive is
worker_rlimit_nofile
- If Nginx was not working, re-enable it with the commands:
# /usr/local/psa/admin/bin/nginxmng -d
# /usr/local/psa/admin/bin/nginxmng -eIf it was already working, just reload it as follows:
# service nginx reload