简体   繁体   English

如何配置 jenkins http 到 https

[英]how to configure jenkins http to https

I changed mydomain http to https using certbot and backend side either.我使用certbot和后端将 mydomain http更改为https (Springboot) (弹簧靴)
But, I hava a problem.但是,我有一个问题。 I can not open jenkins page.我无法打开jenkins页面。
it was http://mydomain:9090它是http://mydomain:9090
I guess it is https problem.我猜是 https 问题。
so I would like to change jenkins http to https.所以我想将 jenkins http 更改为 https。
it didn't work.它没有用。
here is my /etc/default/jenkins:这是我的 /etc/default/jenkins:

# defaults for Jenkins automation server

# pulled in from the init script; makes things easier.
NAME=jenkins

# arguments to pass to java

# Allow graphs etc. to work even when an X server is present
JAVA_ARGS="-Djava.awt.headless=true"

#JAVA_ARGS="-Xmx256m"

# make jenkins listen on IPv4 address
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true"

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/java/$NAME.war

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

# set this to false if you don't want Jenkins 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

# Whether to enable web access logging or not.
# Set to "yes" to enable logging to /var/log/$NAME/access_log
JENKINS_ENABLE_ACCESS_LOG="no"

# 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=9090

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

# arguments to pass to jenkins.
# full list available from java -jar jenkins.war --help
# --javaHome=$JAVA_HOME
# --httpListenAddress=$HTTP_HOST (default 0.0.0.0)
 --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=-1 --httpsPort=9090 --httpsKeyStore=/var/lib/jenkins/jenkins.jks --httpsKeyStorePassword=PASSWORD_SET_ON_CONVERT_TO_JKS"

here is my error page:这是我的错误页面:
errorpage错误页面

here is where I refer to(doesn't work):这是我指的地方(不起作用):
https://www.vhinandrich.com/jenkins-standalone-ssl-lets-encrypt https://www.vhinandrich.com/jenkins-standalone-ssl-lets-encrypt

actually I didn't user --standalone when I make my ssl certificate.实际上,当我制作 ssl 证书时,我没有使用--standalone

anyway, what I wanted to do is to enter jenkins site (http or https I don't mind)无论如何,我想做的是进入 jenkins 站点(http 或 https 我不介意)
please help me.请帮我。
thanks:)谢谢:)

The error indicates that you are trying to access Jenkins HTTP port via HTTPs.该错误表明您正在尝试通过 HTTPs 访问 Jenkins HTTP 端口。 If you want to access via HTTPS you should be calling the SSL port you configured with this flag.如果您想通过 HTTPS 访问,您应该调用使用此标志配置的 SSL 端口。 --httpsPort=8443 . --httpsPort=8443

https://mydomain:8443

Also if you don't want to disable HTTP access simply remove this flag from JENKINS_ARGS --httpPort=-1此外,如果您不想禁用 HTTP 访问,只需从JENKINS_ARGS --httpPort=-1中删除此标志

Also, you seem to have conflicting ports in your configurations.此外,您的配置中似乎有冲突的端口。 Use a different port other than the 9090 for HTTPS if you want to use HTTP port as well.如果您还想使用 HTTP 端口,请为 HTTPS 使用9090以外的其他端口。 You seem to pass --httpPort twice in your configurations.您似乎在配置中通过了--httpPort两次。 Hence Jenkins is using port 9090 as the HTTP port.因此 Jenkins 使用端口9090作为 HTTP 端口。

Either change the following property to have a different port or remove the duplicate --httpPort flag and pass --httpPort=-1 to disable HTTP and use 9090 for HTTPS.更改以下属性以具有不同的端口或删除重复的--httpPort标志并传递--httpPort=-1以禁用 HTTP 并将9090用于 HTTPS。

HTTP_PORT=8080

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM