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/;
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