Nexus 在发布工件时返回错误 502(坏网关)

Ted*_*edi 4 nexus jenkins

我刚刚完成了 Sonatype Nexus 3.2.1-01 的安装,我正在尝试使用 Jenkins 作业和 Nexus Artifact Uploader 2.9 插件发布一些工件。

上传开始正常:

100 % completed (572 kB / 572 kB).
Run Code Online (Sandbox Code Playgroud)

但随后它抛出错误:

Return code is: 502, ReasonPhrase:Bad Gateway.
Run Code Online (Sandbox Code Playgroud)

Jenkins 和 Nexus 服务器都在反向代理后面运行,我认为这是问题的根源。

Apache 日志似乎表明 Nexus 没有回复该请求:

[2017 年 4 月 6 日星期四 18:50:46.128569] [代理:错误] [pid 10327] (32)断管:

[client some_ip:57928] AH01084: pass request body failed to 0.0.0.0:8081 (0.0.0.0)
[Thu Apr 06 18:50:46.128649 2017] [proxy_http:error] [pid 10327] [client some_ip:57928] AH01097: pass request body failed to 0.0.0.0:8081 (0.0.0.0) from some_ip ()
Run Code Online (Sandbox Code Playgroud)

这是我在 Apache 中用于声纳服务器的 VirtualHost 配置:

<IfModule mod_ssl.c>
<VirtualHost *:443>
     ServerAdmin some@email.com
     ServerName  some.website.com
     ServerAlias nsome.website.com

     DocumentRoot /srv/www/nexus/public_html/
     ErrorLog /srv/www/nexus/logs/error.log
     CustomLog /srv/www/nexus/logs/access.log combined

     ProxyPreserveHost On
     ProxyPass / http://0.0.0.0:8081/
     ProxyPassReverse / http://0.0.0.0:8081/
     ProxyPassReverse / https://some.website.com/

     SSLCertificateFile /etc/letsencrypt/live/some.website.com/cert.pem
     SSLCertificateKeyFile /etc/letsencrypt/live/some.website.com/privkey.pem
     Include /etc/letsencrypt/options-ssl-apache.conf
     SSLCertificateChainFile /etc/letsencrypt/live/some.website.com/chain.pem
</VirtualHost>
</IfModule>
Run Code Online (Sandbox Code Playgroud)

我尝试添加以下内容,如其他答案中所述,但没有帮助:

1) 禁用对 SSL 证书的检查(尽管这些是有效的):

SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
Run Code Online (Sandbox Code Playgroud)

2)强制请求标头:

RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
Run Code Online (Sandbox Code Playgroud)

3) 在 ProxyPass 行中设置超时和保持连接选项:

ProxyPass / http://0.0.0.0:8081/ retry=1 acquire=3000 timeout=600 Keepalive=On
Run Code Online (Sandbox Code Playgroud)

Ted*_*edi 6

最后,错误 502(坏网关)与问题的根本原因无关。为快照版本发布的工件上列出的版本不符合 Nexus 策略,这会触发错误。