大网数据广告活动
服务器运维问答

reverse proxy nginx bad gateway

· 52CE 我爱测

We have a reverse proxy server on nginx for a bamboo server but it gives a 502 bad gateway but accessible from reverse proxy server(both centos). nginx.conf: server { listen 80; server_name bamboo.test.foo.com; access_log /var/lo…

问题原文

原帖链接 · Joske · CC BY-SA 3.0

We have a reverse proxy server on nginx for a bamboo server but it gives a 502 bad gateway but accessible from reverse proxy server(both centos).

nginx.conf:

 server {
listen 80;
server_name bamboo.test.foo.com;

access_log  /var/log/nginx/bamboo.test.foo.access.log  main;
  location /bamboo {
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://192.168.10.5:8085;
    client_max_body_size 10M;
   }
proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
    send_timeout                600;
  }

access log:

81.82.215.59 - - [07/Dec/2016:16:19:39 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36" "-"

81.82.215.59 - - [07/Dec/2016:16:19:39 +0000] "GET /favicon.ico HTTP/1.1" 502 575 "http://bamboo.test.foo.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36" "-"

社区高分解答

原帖链接 · DevOops · CC BY-SA 3.0

I had SELinux enabled, which blocked Nginx from making outbound connections.

You can check this with:

# getenforce

If SELinux is on and you're experiencing this, you might try setting httpd_can_network_connect to true, and then restarting nginx:

# setsebool -P httpd_can_network_connect true

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。