# Duplicated directive on reverse proxy

**URL:** <https://www.ruby-forum.com/t/duplicated-directive-on-reverse-proxy/220530>\
**Category:** NGINX\
**Created:** [June 12, 2012, 3:57pm UTC](https://www.ruby-forum.com/t/duplicated-directive-on-reverse-proxy/220530 "2012-06-12T15:57:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [June 12, 2012, 3:57pm UTC](https://www.ruby-forum.com/t/duplicated-directive-on-reverse-proxy/220530/1 "2012-06-12T15:57:53Z")

</div>

Hi, everyone,

I’m going through some trouble with a nginx reverse proxy, and I’m kinda  
newbie to this tool.

Fact is, I used to have 2 reverse proxies for addressing requests from  
Internet on port 80 to their respective servers on intranet, and one of  
them crashed irreversibly, so I’m setting up a new one with similar  
settings to the other one.

My configuration consists on all subdomain configuration files contained  
on /etc/nginx/sites-available and symbolically linked to sites-enabled,  
and included on ngxin.conf. Subdomain files are like this:

error\_log /var/log/nginx/www.DOMAIN.gov.br-error.log;  
server {  
listen 80;  
server\_name www.DOMAIN.gov.br;  
access\_log /var/log/nginx/www.DOMAIN.gov.br-access.log;

# Main location

location / {  
proxy\_pass [http://192.168.9.45/](http://192.168.9.45/);  
proxy\_redirect off;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
}  
}

My nginx.conf:

user www-data;  
worker\_processes 10;

error\_log /var/log/nginx/error.log;  
pid /var/run/nginx.pid;

events {  
worker\_connections 20000;  
use epoll;  
}

worker\_rlimit\_nofile 25000;

http {  
include /etc/nginx/mime.types;  
default\_type application/octet-stream;

```
access_log /var/log/nginx/access.log;

sendfile on;
tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;

gzip on;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

```

}

But when I’m trying to set up such configs to the new server, when  
starting up the service, it goes:

root@proxy01:/etc/init.d# /etc/init.d/nginx start  
Starting nginx: [emerg]: “error\_log” directive is duplicate in  
/etc/nginx/sites-enabled/www.DOMAIN.gov.br:1  
configuration file /etc/nginx/nginx.conf test failed

It only starts when just 1 domain is configured. If another one is set,  
this error comes up. The other configured domain starts with “s”, so  
nginx reads it and goes to the next letter, then we get this.

Appreciate any help!

Cheers,

Silvio

Posted at Nginx Forum:

> **[duplicated directive on reverse proxy](https://forum.nginx.org/read.php?2,227462,227462#msg-227462)**
>
> Hi, everyone, I'm going through some trouble with a nginx reverse proxy, and I'm kinda newbie to this tool. Fact is, I used to have 2 reverse proxies for addressing requests from Internet on port 80 to their respective servers on intranet, and one of...

---

<div class="post-metadata">

**Author:** ![oreaseca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/a9a28c/32.png) [@oreaseca](https://www.ruby-forum.com/u/oreaseca)\
**Post date:** [June 12, 2012, 7:12pm UTC](https://www.ruby-forum.com/t/duplicated-directive-on-reverse-proxy/220530/2 "2012-06-12T19:12:28Z")

</div>

On Tue, Jun 12, 2012 at 09:57:20AM -0400, oreaseca wrote:

Hi there,

> error\_log /var/log/nginx/www.DOMAIN.gov.br-error.log;  
> server {

Quite possibly, just swapping those two lines will make things do what  
you want.

> root@proxy01:/etc/init.d# /etc/init.d/nginx start  
> Starting nginx: [emerg]: “error\_log” directive is duplicate in  
> /etc/nginx/sites-enabled/www.DOMAIN.gov.br:1  
> configuration file /etc/nginx/nginx.conf test failed

error\_log only takes a single value at one level.

Your “include” is at http level, so that’s where your error\_log  
currently  
is. As soon as you put a second error\_log at http level, you’ll see the  
error message.

Put the error\_log line at server level, and it should just Work.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
