Mando
Mando

Reputation: 11712

Jenkins server is not accessible by host name (ip address)

I setup jenkins on my Mac OS X with homebrew and it works just fine via http://localhost:8080 or http://127.0.0.1:8080 I couldn't access jenkins instance via hostname/ipaddress:

 1. http://myjenkinshost.local:8080
 2. http://192.168.0.100:8080

Both links are not accessible even from local computer (jenkins host itself). Same time commands ping 192.168.0.100 and ping myjenkinshost.local work just fine.

Upvotes: 25

Views: 43762

Answers (8)

Ojer_Dev
Ojer_Dev

Reputation: 118

If your Jenkins running through Homebrew (macOS Big Sur),

First things first, you need to unhide the hidden folders.

Since the folder is a hidden folder on macOS. so you will need to do the following things to unhide the folder.

Open Macintosh HD in finder -> and press cmd + shift + . (dot)

This will reveal all hidden folders.

After you unhidden the folder, paste the below command in the terminal:

nano /usr/local/Cellar/jenkins-lts/2.xxx/homebrew.mxcl.jenkins-lts.plist

Change httpListenAddress 127.0.0.1 to 0.0.0.0

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>homebrew.mxcl.jenkins</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/java</string>
      <string>-Dmail.smtp.starttls.enable=true</string>
      <string>-jar</string>
      <string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
      <string>--httpListenAddress=0.0.0.0</string>
      <string>--httpPort=8080</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

Once the above steps are done, you can access the Jenkins using hostname or public ip address.

Upvotes: 0

Steve-Buglione
Steve-Buglione

Reputation: 129

  1. If you have installed Jenkins LTS using Homebrew(macos)

    macOS Installers for Jenkins LTS

  1. The path of the file homebrew.mxcl.jenkins-lts.plist is:

     /opt/homebrew/opt/jenkins-lts/homebrew.mxcl.jenkins-lts.plist
    
  2. Since the the folder opt is a hidden folder on macOS. You will need to do the following to see it in finder.

    Open Macintosh HD in finder -> and press cmd + shift + [.]

    This will reveal all hidden folders.

  3. You now have everything you need to make the required changes. As stated in previous answers.

Upvotes: 0

cyx
cyx

Reputation: 1723

At my macOS 11.4 Big Sur installation the plist file was found here:

/opt/homebrew/Cellar/jenkins-lts/2.xxx.x/homebrew.mxcl.jenkins-lts.plist

Changing ip address to 0.0.0.0 worked as described.

Upvotes: 9

Amazonian
Amazonian

Reputation: 119

If your Jenkins running through Homebrew (macos), don't touch /Users/admin/Library/LaunchAgents/homebrew.mxcl.jenkins.plist

Use this one: /usr/local/Cellar/jenkins/2.xxx/homebrew.mxcl.jenkins.plist

Change httpListenAddress to 0.0.0.0

Upvotes: 1

Erick Mwazonga
Erick Mwazonga

Reputation: 1300

By starting jenkins using sudo /etc/init.d/jenkins restart instead of sudo service jenkins start started the browser access. I hope it will be helpful.

Upvotes: 3

jinjorge
jinjorge

Reputation: 141

The correct location of the file to edit is /usr/local/opt/jenkins/homebrew.mxcl.jenkins.plist

Found the answer here

Upvotes: 14

DreamTeam Mobile
DreamTeam Mobile

Reputation: 571

It turned out that launch agent was configured to listen only 127.0.0.1 (or localhost). To fixed that edit jenkins agent's plist:

nano /Users/admin/Library/LaunchAgents/homebrew.mxcl.jenkins.plist

and modify httpListenAddress to 0.0.0.0 instead of 127.0.0.1

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>homebrew.mxcl.jenkins</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/java</string>
      <string>-Dmail.smtp.starttls.enable=true</string>
      <string>-jar</string>
      <string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
      <string>--httpListenAddress=0.0.0.0</string>
      <string>--httpPort=8080</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

Upvotes: 30

Ravindranath Barathy
Ravindranath Barathy

Reputation: 791

I came across something like this but, it was for windows,I'm sure the steps to resolve will be the same,Please give it a try: https://apple.stackexchange.com/questions/31376/how-can-i-open-port-8080-of-mac-os-x-lion

Upvotes: 1

Related Questions