P
P
Pavel2017-02-17 05:04:59
Nginx
Pavel, 2017-02-17 05:04:59

How to change NGINX settings?

I have an nginx server with port 80 open. have a webserver on another machine on the same network, but without internet access. THOSE. requests come from the Internet to the nginx server, which redirects them to the web server through itself and vice versa...
Web server config from /etc/nginx/sites-available

upstream www.example.ru {
  server 192.168.3.10:80;
}
 
server {
    listen      80;
    server_name www.example.ru;
 
    access_log  /var/log/nginx/example.ru/nginx_access.log;
    error_log   /var/log/nginx/example.ru/nginx_error.log;
 
    #
    location / {
        proxy_pass     http://example.ru;
    }
 
    error_page 404      /404.php;
 
    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504  /50x.html;
    location = /50x.html {
        root    /var/www;
    }
 
    # htaccess и htpasswаем
    location ~ /\.ht {
        deny  all;
    }
 
    location ~ .php$ {
        proxy_pass http://www.example.ru;
    }
 
    location ~ /$ {
        proxy_pass http://www.example.ru;
    }
}

Everything seems to be working, but in the web server logs there are attempts to guess passwords, from nginx's IP
How to make the IP of the one who guesses passwords displayed?
Also, if there are any other suggestions for editing the config, please explain...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Chudnovsky, 2017-02-17
@pbt39

As written in the documentation , you should add

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question