nginx로 reverse proxy 이용할려고 하니 계속 오류 발생. 단순 nginx conf 관련 오류로 판단해서, 설정을 이리 저리 수정 해도 안됨
대강 아래와 같은 오류 발생
GET / HTTP/2.0", upstream: "http://127.0.0.1:5678/", host: "192.168.1.50" 2024/05/01 21:35:47 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET /nginx-logo.png HTTP/2.0", upstream: "http://127.0.0.1:5678/nginx-logo.png", host: "192.168.1.50", referrer: "https://192.168.1.50/" 2024/05/01 21:35:48 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:5678/", host: "192.168.1.50" 2024/05/01 21:35:48 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET /nginx-logo.png HTTP/2.0", upstream: "http://127.0.0.1:5678/nginx-logo.png", host: "192.168.1.50", referrer: "https://192.168.1.50/" 2024/05/01 21:35:48 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:5678/", host: "192.168.1.50" 2024/05/01 21:35:48 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET /nginx-logo.png HTTP/2.0", upstream: "http://127.0.0.1:5678/nginx-logo.png", host: "192.168.1.50", referrer: "https://192.168.1.50/" 2024/05/01 21:35:49 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:5678/", host: "192.168.1.50" 2024/05/01 21:35:49 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET /nginx-logo.png HTTP/2.0", upstream: "http://127.0.0.1:5678/nginx-logo.png", host: "192.168.1.50", referrer: "https://192.168.1.50/" 2024/05/01 21:35:49 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:5678/", host: "192.168.1.50" 2024/05/01 21:35:49 [crit] 41577#41577: *1 connect() to 127.0.0.1:5678 failed (13: Permission denied) while connecting to upstream, client: 192.168.1.162, server: 192.168.1.50, request: "GET /nginx-logo.png HTTP/2.0", upstream: "http://127.0.0.1:5678/nginx-logo.png", host: "192.168.1.50", referrer: "https://192.168.1.50/"
nginx 설정은 대강 아래와 같음
[root@localhost nginx]# cat conf.d/n8n.conf server { listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate "/etc/pki/nginx/rootCA.crt"; ssl_certificate_key "/etc/pki/nginx/private.key"; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; chunked_transfer_encoding off; proxy_buffering off; proxy_cache off; proxy_read_timeout 1200s; charset utf-8; location / { proxy_pass http://127.0.0.1:5678; } location /webhook { proxy_pass http://127.0.0.1:5678; } location /webhook-test { proxy_pass http://127.0.0.1:5678; } #location /static/ # { # alias /home/web/web/static/; # } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } }
문제 해결 명령어
[root@localhost nginx]# setsebool httpd_can_network_connect on
접속가능하게 됨