Answer the question
In order to leave comments, you need to log in
Load balancing on NGiNX?
Comrades, it's already unbearable. I have a need to load balance using nginx on a cluster. Balancing with ngx_http_upstream_module and proxy_pass . In the manuals, everything is described surprisingly elementary, but ...
nginx.conf:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
upstream apps {
server 192.168.1.237:8080;
server 192.168.1.240:8080;
}
server {
listen 80;
server_name _;
location / {
proxy_pass http://apps;
}
}
}
2016/04/13 18:36:59 [crit] 5427#0: *20 connect() to 192.168.1.240:8080 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.15, server: _, request: "GET / HTTP/1.1", upstream: "http://192.168.1.240:8080/", host: "192.168.1.135"
2016/04/13 18:36:59 [crit] 5427#0: *20 connect() to 192.168.1.237:8080 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.15, server: _, request: "GET / HTTP/1.1", upstream: "http://192.168.1.237:8080/", host: "192.168.1.135"
sudo cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx
sudo semodule -i mynginx.pp
Answer the question
In order to leave comments, you need to log in
Workable option:
location / {
proxy_pass http://apps;
proxy_redirect http://192.168.1.135:8080 http://192.168.1.135;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
getsebool -a | grep httpd
, and if the setting is http_can_network_connect
disabled, we need to enable it:
Missing proxy_pass
http://00.00.00.00:80/zabbix/ ;
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;
Rather, everyone screwed up with the config. Write the entire config.
semodule was changed in vain, this is the second error
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question