如何在 Ubuntu 12.04 服务器上远程访问 Jenkins?

如何在 Ubuntu 12.04 服务器上远程访问 Jenkins?

我已经在 Ubuntu 12.04 服务器上安装了 Jenkins 并打开了端口 8080,但仍然无法远程访问 Jenkins。以下是我采取的措施。

# Install Jenkins, enable UFW and open port 8080
sudo apt-get install jenkins
sudo ufw enable
sudo ufw allow 8080
sudo ufw reload

# Check the status
sudo ufw status
8080    ALLOW    Anywhere
8080    ALLOW    Anywhere (v6)

# Locally
curl -I localhost:8080
HTTP/1.1 200 OK
Server: Winstone Servlet Engine v0.9.10
...

# On an external machine
curl -I [ip]:8080
couldn't connect to host

答案1

我遇到了这个问题,通过编辑詹金斯配置文件解决了

sudo vim /etc/default/jenkins

编辑 HTTP_HOST,默认 127.0.0.1 为

HTTP_HOST=0.0.0.0

答案2

添加 JENKINS_ARGS

JENKINS_ARGS="--prefix=/jenkins --httpListenAddress=YOUR_IP --ajp13ListenAddress=YOUR_IP"

在 Centos/Redhat 上,您可以在 /etc/sysconfig/jenkins 找到。

答案3

我最近遇到了这个问题,通过向 uft 防火墙添加 8080 端口访问解决了该问题。

sudo ufw 允许 8080

答案4

您使用什么防火墙?如果您使用 iptables,则运行 sudo iptables -L 以查看哪些端口已打开/阻止。

相关内容