首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jenkins拒绝连接端口8080

Jenkins拒绝连接端口8080
EN

Stack Overflow用户
提问于 2017-07-01 15:01:13
回答 3查看 25.8K关注 0票数 6

我已经在Ubuntu服务器上配置了Jenkins,几乎两个月来一切正常,Jenkins正在构建作业和运行测试用例。但最近我增加了测试用例的数量。一段时间后,当我通过web浏览器打开Jenkins时,它开始拒绝连接。

IP:8080给出了一个错误“连接被拒绝”。

我尝试通过以下方式重新启动Jenkins服务:

代码语言:javascript
复制
sudo service jenkins restart

它正常重启,但jenkins仍然没有在浏览器上打开。

然后我检查了/etc/default/jenkins中jenkins的默认设置

代码语言:javascript
复制
# defaults for jenkins continuous integration server
# pulled in from the init script; makes things easier.
NAME=jenkins

# location of java
JAVA=/usr/bin/java

# arguments to pass to java
JAVA_ARGS="-Djava.awt.headless=true"  # Allow graphs etc. to work even when an X server is present
JAVA_ARGS="-Xmx1024m"
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 address

PIDFILE=/var/run/$NAME/$NAME.pid

# user and group to be invoked as (default to jenkins)
JENKINS_USER=$NAME
JENKINS_GROUP=$NAME

# location of the jenkins war file
JENKINS_WAR=/usr/share/$NAME/$NAME.war

# jenkins home location
JENKINS_HOME=/var/lib/$NAME

# set this to false if you don't want Hudson to run by itself
# in this set up, you are expected to provide a servlet container
# to host jenkins.
RUN_STANDALONE=true

# log location.  this may be a syslog facility.priority
JENKINS_LOG=/var/log/$NAME/$NAME.log
#JENKINS_LOG=daemon.info

# OS LIMITS SETUP
#   comment this out to observe /etc/security/limits.conf
#   this is on by default because http://github.com/jenkinsci/jenkins/commit/2fb288474e980d0e7ff9c4a3b768874835a3e92e
#   reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file
#   descriptors are forced to 1024 regardless of /etc/security/limits.conf
MAXOPENFILES=8192

# set the umask to control permission bits of files that Jenkins creates.
#   027 makes files read-only for group and inaccessible for others, which some security sensitive users
#   might consider benefitial, especially if Jenkins runs in a box that's used for multiple purposes.
#   Beware that 027 permission would interfere with sudo scripts that run on the master (JENKINS-25065.)
#
#   Note also that the particularly sensitive part of $JENKINS_HOME (such as credentials) are always
#   written without 'others' access. So the umask values only affect job configuration, build records,
#   that sort of things.
#
#   If commented out, the value from the OS is inherited,  which is normally 022 (as of Ubuntu 12.04,
#   by default umask comes from pam_umask(8) and /etc/login.defs

# UMASK=027

# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8080


# servlet context, important if you want to use apache proxying  
PREFIX=/$NAME

# arguments to pass to jenkins.
# --javahome=$JAVA_HOME
# --httpPort=$HTTP_PORT (default 8080; disable with -1)
# --httpsPort=$HTTP_PORT
# --argumentsRealm.passwd.$ADMIN_USER=[password]
# --argumentsRealm.roles.$ADMIN_USER=admin
# --webroot=~/.jenkins/war
# --prefix=$PREFIX

JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT"

这个文件看起来一切正常,war文件也在给定的位置。

当我重新启动服务器3-4次时,它又开始打开了。但这个问题仍然会一次又一次地出现。每次打开Jenkins时,我都必须重新启动服务器。

有人能帮我定位这个问题并告诉我如何解决它吗?

EN

回答 3

Stack Overflow用户

发布于 2020-09-20 01:19:58

我在亚马逊网络服务EC2上运行Jenkins时收到了这个错误,并试图从外部访问它(在我的例子中是来自内部网络的一个实例)。

当我从Jenkins服务器内部运行curl localhost:8080时,一切正常,但是当我从内部网络执行同样的操作时,我得到了提到的refused to connect on port 8080错误。

解决方案是vim /etc/sysconfig/jenkins和change:

代码语言:javascript
复制
JENKINS_LISTEN_ADDRESS="127.0.0.1"

至:

代码语言:javascript
复制
JENKINS_LISTEN_ADDRESS="0.0.0.0"
票数 0
EN

Stack Overflow用户

发布于 2021-02-20 03:55:07

我花了一段时间才弄明白这个问题。对我来说,这是在修改我的Windows密码之后发生的。解决方案是更新Jenkins Service的凭据。

在Windows搜索栏中,键入

  • ,然后按enter键。

  • 然后向下滚动到Jenkins并双击它。

  • 在Jenkins属性中,选择选项卡"Log on“。选择复选框"This account"

  • Update username
  1. password。

瞧!现在Jenkins web可以通过Jenkins服务连接到Jenkins机器。

票数 0
EN

Stack Overflow用户

发布于 2017-08-17 20:59:28

运行:

代码语言:javascript
复制
systemctl stop firewalld.service

然后重试

票数 -6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44858275

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档