我想设置一个Nginx服务器(公共),它将git webhooks转发到在Apache(私有)上运行的Jenkins。
我已经将Nginx配置设置为代理传递给Jenkins(在Apache上运行)。从PC上一切正常,就像当我点击Nginx URL(没有任何标题)时,它可以正确路由到Apache上的Jenkins。
但是当我启用git webhooks时,我看到请求正在到达Nginx,但是Nginx并未将请求转发到Apache,并且失败并显示“ 301 Moved Permanently”。 GitHub实际上对Nginx进行了后期调用,标题如下:
Request method: POST
content-type: application/x-www-form-urlencoded
Expect:
User-Agent: GitHub-Hookshot/8f0ea18
X-GitHub-Delivery: 6a64cb70-e86d-11e8-849f-eec77e260f21
X-GitHub-Event: ping
这是我的Nginx配置:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name jenkins-nginx.pcloud.com
56.69.56.194;
ssl_certificate "/etc/nginx/server.crt";
ssl_certificate_key "/etc/nginx/server_nopass.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://jenkins.pcloud.com;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}