我刚刚尝试像往常一样在我的 VPS 上加入 Jenkins。当我尝试访问 URL 时,它返回错误代码 ERR_CONNECTION_TIMED_OUT。我的网站的端口 8080 和其他端口也发生了这种情况。我可以加入我的 SSH 会话。
这些端口是 UFW 允许的。
Status: active
To Action From
-- ------ ----
5432 ALLOW Anywhere
443/tcp ALLOW Anywhere
21 ALLOW Anywhere
9080 ALLOW Anywhere
27015/udp ALLOW Anywhere
7777/udp ALLOW Anywhere
7778/udp ALLOW Anywhere
27020/tcp ALLOW Anywhere
7778/tcp ALLOW Anywhere
27050/udp ALLOW Anywhere
27050/tcp ALLOW Anywhere
27015/tcp ALLOW Anywhere
27000/tcp ALLOW Anywhere
27100/tcp ALLOW Anywhere
27036/tcp ALLOW Anywhere
27100/udp ALLOW Anywhere
27031/udp ALLOW Anywhere
4379/udp ALLOW Anywhere
4380/udp ALLOW Anywhere
27014/udp ALLOW Anywhere
27030/udp ALLOW Anywhere
27016 ALLOW Anywhere
27020 ALLOW Anywhere
22 ALLOW Anywhere
8080 ALLOW Anywhere
5432 (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
21 (v6) ALLOW Anywhere (v6)
9080 (v6) ALLOW Anywhere (v6)
27015/udp (v6) ALLOW Anywhere (v6)
7777/udp (v6) ALLOW Anywhere (v6)
7778/udp (v6) ALLOW Anywhere (v6)
27020/tcp (v6) ALLOW Anywhere (v6)
7778/tcp (v6) ALLOW Anywhere (v6)
27050/udp (v6) ALLOW Anywhere (v6)
27050/tcp (v6) ALLOW Anywhere (v6)
27015/tcp (v6) ALLOW Anywhere (v6)
27000/tcp (v6) ALLOW Anywhere (v6)
27100/tcp (v6) ALLOW Anywhere (v6)
27036/tcp (v6) ALLOW Anywhere (v6)
27100/udp (v6) ALLOW Anywhere (v6)
27031/udp (v6) ALLOW Anywhere (v6)
4379/udp (v6) ALLOW Anywhere (v6)
4380/udp (v6) ALLOW Anywhere (v6)
27014/udp (v6) ALLOW Anywhere (v6)
27030/udp (v6) ALLOW Anywhere (v6)
27016 (v6) ALLOW Anywhere (v6)
27020 (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
答案1
问题是我在 iptables 中设置了一系列限制,阻止了除 SSH 之外的传入连接。
为了禁用这些限制,我运行了以下命令:
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
之后,我激活了 ufw 并添加了在我的 jenkins 中配置的端口(9080)。
sudo ufw allow ssh
sudo ufw enable
sudo ufw allow 9080
我在这篇文章中找到了答案:如何在 ubuntu 上启动和停止 iptables