Nginx emergproxy pass directive is duplicate in conf

July 14, 2021 . 2 MIN READ

https://stackoverflow.com/questions/51709558/nginx-emerg-xxx-directive-is-duplicate-in-etc-nginx-conf-d-xxx-conf7

 

nginx: [emerg] “XXX” directive is duplicate in /etc/nginx/conf.d/XXX.conf:7

Ask Question

Asked 2 years, 10 months ago

Active 20 days ago

Viewed 5k times

4

when doing

nginx -t

error message :

nginx: [emerg] “client_max_body_size” directive is duplicate in /etc/nginx/conf.d/proxy-settings.conf:7

nginx

Share

Improve this question

Follow

edited Aug 6 ’18 at 14:14

 

Barry

3,13477 gold badges2020 silver badges4040 bronze badges

asked Aug 6 ’18 at 14:07

 

Durga Prasad

7111 silver badge99 bronze badges

Add a comment

2 Answers

ActiveOldestVotes

3

Remove the second copy of the directive from file /etc/nginx/conf.d/proxy-settings.conf – at line 7.

Share

Improve this answer

Follow

answered Aug 6 ’18 at 15:05

 

IVO GELOV

8,52011 gold badge99 silver badges1616 bronze badges

  • Is there another solution? I have set client_max_body_size in a global scope to a high value and want to set it to a lower value in just one server location. Maybe you can solve this by defining an upstreamand use proxy_pass to redirect at the right condition? – rubo77 Jun 3 ’20 at 9:39
  • I am not sure about upstream/proxy_pass- but if you remove the global setting and put it inside each server block I am sure 100% that it will work. It feels inconvenient – but only if you are changing your config too often (and in this case you should be generating the config automatically using some scripting – not manually) – otherwise the solution is perfectly fine. – IVO GELOV Jun 3 ’20 at 9:48

Add a comment

0

actually i also defined “client_max_body_size” in /etc/nginx/sites-enabled/XXX.config, so the same variable “client_max_body_size” is duplicated in /etc/nginx/conf.d/proxy-settings.conf – that is the reason it is giving that error.

I resolved by removing the duplicate variable in /etc/nginx/conf.d/proxy-settings.conf :

 

Leave a Reply

Your email address will not be published. Required fields are marked *