Jenkins reverse proxy on single domain with multiple apps

Francis Daly francis at daoine.org
Sun Feb 25 15:33:33 UTC 2018


On Sun, Feb 25, 2018 at 03:08:28AM -0500, kefiras at gmail.com wrote:

Hi there,

> I am trying to setup a reverse proxy on a single domain to host multiple
> apps separated by URI, for example:
> http://localhost/app1
> http://localhost/app2
> etc.

You will be much happier if your nginx/app1/ application believes that
it is installed at appserver/app1/, and not at appserver/.

> Right know having problems with reverse proxy jenkins which sends HTML page
> in HTTP reply with relative paths eg. /static/abc/css/common.css

For jenkins, use the jenkins "prefix" argument. For other apps, use
whatever their config/install options are.

> So far I have rewritten the content to the login screen as per below but I
> want to know if there is any other way to rewrite this automatically:

The easiest way is not to have to rewrite anything.

If jenkins is installed at /jenkins, then your nginx config will be
pretty much "proxy_pass http://jenkins:8080;", unless you specifically
want nginx to handle some of the static files instead of jenkins.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list