ThoWe
ThoWe

Reputation: 346

NGINX proxy http://host/jenkins to http://host:8080

I try to use NGINX as a reverse proxy for my Jenkins server. Basically when http://host/jenkins gets opened in the browser NGINX should proxy the request to http://host:8080 where Jenkins is listening.

I tried various different configurations but none really works. Here the location configuration that I use at the moment. It somehow works, but does not show any images, etc..

location /jenkins/ {
  proxy_set_header Host $http_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_pass          http://localhost:8080/;
  proxy_read_timeout  90s;
  # Fix potential "It appears that your reverse proxy set up is broken" error.
  proxy_redirect      http://localhost:8080/ https://host/jenkins/;
}

Upvotes: 0

Views: 674

Answers (1)

Shawn C.
Shawn C.

Reputation: 6841

Make sure to update your Jenkins configuration

JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=/jenkins"

Taken from https://wiki.jenkins.io/display/JENKINS/Jenkins+behind+an+NGinX+reverse+proxy

Upvotes: 1

Related Questions