nginx – 上游过早关闭连接,同时从上游读取响应头

weixin_38057949 2019-09-12 01:22:15
我在为Jenkins CI服务器设置SSL时遇到问题.我在nginx后面使用Jenkins作为反向代理.我在jenkins.error.log文件中从上游错误中读取响应头时,正在获取这些上游过早关闭的连接. 2014/09/30 13:01:49 [error] 4875#0: *1 upstream prematurely closed connection while reading response header from upstream, client: <MY IP ADDR>, server: jenkins.<SERVER URL>.com, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host: "jenkins.<SERVER URL>.com" 2014/09/30 13:01:50 [error] 4875#0: *1 upstream prematurely closed connection while reading response header from upstream, client: <MY IP ADDR>, server: jenkins.<SERVER URL>.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "jenkins.<SERVER URL>.com" jenkins正在运转.我可以通过https://< SERVER IP ADDR>:8080连接(即使Chrome抱怨证书).虽然nginx为官方网址提供了502 Bad Gateway消息. 站点可用配置: upstream jenkins { server 127.0.0.1:8080 fail_timeout=0; } server { listen 80; return 301 https://$host$request_uri; } server { listen 443; #listen [::]:443 default ipv6only=on; server_name jenkins.<SERVER URL>.com <SERVER IP ADDR>; ssl on; ssl_certificate /etc/nginx/ssl/jenkins.<SERVER URL>.com.chained.crt; ssl_certificate_key /etc/nginx/ssl/<SERVER URL>.com.key; access_log /etc/nginx/logs/jenkins.access.log; error_log /etc/nginx/logs/jenkins.error.log; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect http:// https://; proxy_pass http://jenkins; } }
...全文
419 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38075729 2019-09-12
  • 打赏
  • 举报
回复
问题出在Jenkins身上.我们最初禁用了Jenkins的http端口,只允许使用https.一旦我们再次允许http,我们只允许来自127.0.0.1的请求,这解决了我们的问题. tl; dr:启用http端口,仅允许通过127.0.0.1的请求

435

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧