无法访问VirtualBox中冲煮安装的Jenkins

时间:2020-07-31 08:13:45

标签: macos jenkins virtualbox

我通过brew install jenkins-lts在macOS中安装了Jenkins。

macOS在Windows主机上作为VirtualBox VM实例运行。

在VirtualBox主机Windows上,我无法从浏览器通过http://localhost:8080http://10.0.2.15:8080访问Jenkins。 (10.0.2.15是我的访客VM macOS的IP地址)

我设置的内容

  • Jenkins-lts服务已启动。 macOS Safari可以通过http://localhost:8080
  • 访问
  • 已设置VirtualBox端口转发,TCP / HOST:0.0.0.0:8080 / GUEST:10.0.2.15:8080
  • 通过针对SSH主机的相同端口转发设置:0.0.0.0:22 / GUEST:10.0.2.15:22,我可以成功连接到SSH

1 个答案:

答案 0 :(得分:0)

通过默认配置文件/usr/local/Cellar/jenkins-lts/2.x.x/homebrew.mxcl.jenkins-lts.plistbrew-installed Jenkins的默认监听地址是127.0.0.1而不是0.0.0.0。这导致Jenkins的Web服务器仅侦听来自localhost的请求,而不是任何网络适配器。

步骤

  1. 编辑配置文件vi /usr/local/Cellar/jenkins-lts/2.x.x/homebrew.mxcl.jenkins-lts.plist
  2. 找到行<string>--httpListenAddress=127.0.0.1</string>,然后更改为<string>--httpListenAddress=0.0.0.0</string>
  3. 重新启动Jenkins,brew services restart jenkins-lts

参考

  1. https://www.jenkins.io/doc/book/installing/,表示为httpListenAddress
  2. https://medium.com/@vishnuteja/install-jenkins-as-a-service-on-macos-and-change-port-number-9aa097e5cfbf,表示在Brew上安装Jenkins的配置文件。
相关问题