I try to use upstream and proxy for load balancing on CentOS 7 Minimal, but something is wrong. I use this manual: http://nginx.org/en/docs/http/load_balancing.html. When I open Nginx localhost in browser, it tells me, that «Site is temporarily unavailable» and writes this strings in error log:
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"
Someone adviced me to turn off SElinux and see what I'll get. But when turned it off, I go to [upstream name] link, not the [upstream server].
I mean, when i use:
…
upstream sites { server 192.168.1.237:8080; }
…
location / { proxy_pass http://sites; }
…
I point my browser to http://localhost, and nginx redirects me to http://sites:8080, instead of http://192.168.1.1:8080.
I can't understand what's wrong, the manual said everything should work.
Help, please.
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"
Someone adviced me to turn off SElinux and see what I'll get. But when turned it off, I go to [upstream name] link, not the [upstream server].
I mean, when i use:
…
upstream sites { server 192.168.1.237:8080; }
…
location / { proxy_pass http://sites; }
…
I point my browser to http://localhost, and nginx redirects me to http://sites:8080, instead of http://192.168.1.1:8080.
I can't understand what's wrong, the manual said everything should work.
Help, please.