5

I have installed Jenkins on Apache container and started it, but whenever I am trying to access it using the URL http://localhost:8080/jenkins/ I am being redirected to the URL http://localhost:8080/jenkins/login?from=%2Fjenkins%2F and then the pop up attached appears asking me for the password, I pasted the password from the file that is mentioned, to the textbox it is not getting disappeared, unsure what to do.This is the pop up I am having while accessing the URL for the Jenkins

viveksinghggits
  • 661
  • 14
  • 35

4 Answers4

2

in my case the Jenkins was not unlocking with initial Admin password, then I thought of setting it up initially with Apache and then proceed with fixing the problem . The problem was in the number of slashes you put after ProxyPass and ProxyPassReverse entries.

Wrong entries

ProxyRequests     Off
ProxyPreserveHost On
<Proxy http://localhost:8081/jenkins*>
   Order deny,allow
   Allow from all
</Proxy>
ProxyPass /jenkins http://localhost:8081/jenkins/ nocanon
AllowEncodedSlashes NoDecode
ProxyPassReverse /jenkins http://localhost:8081/jenkins/
ProxyPassReverse /jenkins http://your.hostname.domain/jenkins/
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"

Correct one which worked.

ProxyRequests     Off
ProxyPreserveHost On
<Proxy http://localhost:8081/jenkins*>
   Order deny,allow
   Allow from all
</Proxy>
ProxyPass /jenkins http://localhost:8081/jenkins nocanon
AllowEncodedSlashes NoDecode
ProxyPassReverse /jenkins http://localhost:8081/jenkins
ProxyPassReverse /jenkins http://your.hostname.domain/jenkins
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"

Let me know your thoughts.

Avinash Barnwal
  • 181
  • 1
  • 7
  • This worked for me on Linux Centos 7 having Apache as a reverse proxy for Jenkins running on 8081 since Apache already runs on 80 and 443 plus Tomcat running on 8080. Other useful source for me was https://wiki.jenkins.io/display/JENKINS/Running+Jenkins+behind+Apache – a4bike Jan 17 '20 at 17:52
1

use instructions from https://github.com/geerlingguy/ansible-role-jenkins/issues/50#issuecomment-214935354 and check an update below regarding locking access for anonymous users - worked for me today.

Shamelessly stolen from the link above:

  1. Create the file /var/lib/jenkins/jenkins.install.UpgradeWizard.state with one line 2.0
  2. Create the file /var/lib/jenkins/init.groovy.d/basic-security.groovy with the contents:

    #!groovy

    import jenkins.model.* import hudson.security.*

    def instance = Jenkins.getInstance()

    println "--> creating local user 'admin'"

    def hudsonRealm = new HudsonPrivateSecurityRealm(false) hudsonRealm.createAccount('admin','admin') instance.setSecurityRealm(hudsonRealm)

    def strategy = new FullControlOnceLoggedInAuthorizationStrategy() instance.setAuthorizationStrategy(strategy) instance.save()

Open Food Broker
  • 1,095
  • 1
  • 8
  • 31
  • 1
    A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](//stackoverflow.com/help/deleted-answers) – LW001 Feb 24 '18 at 22:40
  • Currently, it is 2.7.1... but adding JAVA_OPTS=-Djenkins.install.runSetupWizard=false also do the trick – jehon Feb 18 '21 at 15:11
0

you should deploy your jenkins to ......./tomcat/webapps/root then the jenkins url should like 'http://localhost:8080/login?from=%2F', when it is done,just copy code in the file ..../initialAdminPassword to Administrator password

0

Type your linux ipaddress:8080/jenkins/.So to unlock your jenkins type ifconfig and know your ip address

For example my ip address for centos is 192.168.2.4 I type 102.168.2.4:8080/jenkins/ in my web browser. Good luck

Asmoun
  • 1,417
  • 5
  • 20
  • 53