Cannot Expose Jenkins Externally

I'm hosting jenkins on windows (historical reasons) Just updated it from 1.620 to 2.62

Everything works as expected, except the tiny details that I cannot access it anymore. Only accessing it from host works.

I found numerous posts about it and they all suggested changing startup params to set:

--httpListenAddress=0.0.0.0

or

--httpListenAddress=HOST

I've tried both solutions, same result. Jenkins works when accessed from the host by:

  • 127.0.0.1
  • 10.0.1.11 (internal ip)
  • x.x.x.x (external ip)
  • HOST

but doesn't work when accessed from any other machine.

I've checked firewall and azure settings. Other service (nexus:8081) is accessible as expected. Changing port to 8080 didn't help.

that's jenkins.xml

<service>
  <id>jenkins</id>
  <name>Jenkins</name>
  <description>This service runs Jenkins continuous integration system.            
</description>
  <env name="JENKINS_HOME" value="%BASE%"/>
  <env name="HTTP_HOST" value="HOST.cloudapp.net"/>
  <executable>%JAVA_HOME%\jre\bin\java</executable>
  <arguments>-Xrs -Xmx512M -Dfile.encoding=UTF8 -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=80 --httpListenAddress="%HTTP_HOST%" --webroot="%BASE%\war"</arguments>
  <logmode>rotate</logmode>
  <onfailure action="restart" />
</service>

that's jenkins log

INFO: Started w.@1750fbeb{/,file:///E:/Program%20Files%20(x86)/Jenkins/war/,AVAILABLE}{E:\Program Files (x86)\Jenkins\war}
May 25, 2017 2:17:51 AM org.eclipse.jetty.server.AbstractConnector doStart
INFO: Started ServerConnector@7ae0a9ec{HTTP/1.1,[http/1.1]}{HOST.cloudapp.net:80}
May 25, 2017 2:17:51 AM org.eclipse.jetty.server.Server doStart
INFO: Started @4534ms
May 25, 2017 2:17:51 AM winstone.Logger logInternal
INFO: Winstone Servlet Engine v4.0 running: controlPort=disabled
May 25, 2017 2:17:54 AM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
May 25, 2017 2:17:55 AM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
(removed few lines about ruby failing)
INF/
May 25, 2017 2:18:04 AM jenkins.InitReactorRunner$1 onTaskFailed
SEVERE: Failed Loading plugin ruby-runtime v0.12 (ruby-runtime)
May 25, 2017 2:18:40 AM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running

when httpListenAddress was 0.0.0.0 log was:

INFO: Started ServerConnector@7ae0a9ec{HTTP/1.1,[http/1.1]}{0.0.0.0:80}
1

2 Answers

so turns out this question has nothing to do with Jenkins. So I apologize anyone you tried answering. (Correct setting is either using the default value for httpListenAddress or setting it to --httpListenAddress=0.0.0.0)

It was windows firewall. For old jenkis - 1.620 firewall had a rule for Java 6 and port 80. New jenkins is using Java 8 which was blocked.

Changing firewall rules fixed the problem.

For anybody trying to install Jenkins on Windows in a PowerShell script, this is how to tell the firewall to open the port:

New-NetFirewallRule -Name jenkins -DisplayName 'Jenkins' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 8080

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest