Answer the question
In order to leave comments, you need to log in
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;
}
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question