Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins redirect / to /jenkins on standalone installation

Tags:

jenkins

We have the standard Debian installation of Jenkins (winstone only, no tomcat or apache involved), which we are running with --prefix=/jenkins and on port 80.

Now when I access http://my.server/ I get a 404 page. Can I convince Winstone somehow to redirect that to the correct address http://my.server/jenkins/?

EDIT: I know I could install Apache, and use the following Rewrite Rule to get what I want:

RewriteEngine On
RewriteRule ^/*$ https://jenkins.corp.mobile.de/jenkins/ [R]

My question is how to do this in Winstone.

like image 946
marc.guenther Avatar asked Nov 27 '22 11:11

marc.guenther


1 Answers

The typical way to do what you want is to run Jenkins in some high port, like 8080 with --prefix=/jenkins and then run something like Apache or Nginx in port 80 configured to reverse proxy /jenkins to http://localhost:8080/jenkins

For Apache, you could add something like this to Apache's config file:

ProxyPass         /jenkins  http://localhost:8080/jenkins
ProxyPassReverse  /jenkins  http://localhost:8080/jenkins
ProxyRequests     Off

# Allow direct access to Jenkins only from localhost i.e. Apache
<Proxy http://localhost:8080/jenkins*>
  Order deny,allow
  Allow from 127.0.0.1
</Proxy>

You should tune the access controls in the directive according to where you want to accept connections to Jenkins.

like image 187
sti Avatar answered Dec 04 '22 05:12

sti