简体   繁体   中英

Nginx in front of Apache

I want to setup an Nginx server(public) which forwards the git webhooks to Jenkins which is running on Apache (private).

I have setup the Nginx config to proxy pass to Jenkins (runs on Apache). It's all working well in from my PC, like when I hit the Nginx URL (without any headers), it is properly routing to Jenkins on Apache.

But when I enable the git webhooks I see the request is reaching the Nginx, but Nginx is not forwarding the request to Apache and fails with "301 Moved Permanently". The GitHub actually does a post call to Nginx with some headers below:

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

Here is my Nginx config:

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 {
    }
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM