Jenkins server is not accessible by host name (ip

2019-02-03 10:14发布

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.

4条回答
forever°为你锁心
2楼-- · 2019-02-03 10:36

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>
查看更多
一夜七次
3楼-- · 2019-02-03 10:36

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

查看更多
我想做一个坏孩纸
4楼-- · 2019-02-03 10:41

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.

查看更多
Viruses.
5楼-- · 2019-02-03 10:45

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

Found the answer here

查看更多
登录 后发表回答