如何让Jenkins在不同的端口上运行?

t3psigkw  于 2023-10-17  发布在  Jenkins
关注(0)|答案(1)|浏览(155)

我在尝试更改我的jenkins端口时遇到了一些麻烦,因为我希望将端口8080用于不同的服务。到目前为止,我已经尝试过了:
目前在amazon linux上运行:
Jenkins版本:Jenkins 2.332.1
我尝试编辑配置文件:/etc/sysconfig/jenkins至:

JENKINS_PORT="7777"

然而,在我重新启动jenkins之后,端口没有改变:

● jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/jenkins.service.d
           └─override.conf
   Active: active (running) since Tue 2022-04-05 15:52:24 UTC; 1min 33s ago
 Main PID: 1017 (java)
    Tasks: 36
   Memory: 500.6M
   CGroup: /system.slice/jenkins.service
           └─1017 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080

Apr 05 15:53:38 ip-172-0-2-240.eu-west-1.compute.internal jenkins[1017]: at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
Apr 05 15:53:38 ip-172-0-2-240.eu-west-1.compute.internal jenkins[1017]: at java.net.URLClassLoader$1.run(URLClassLoader.java:363)

我错过了什么?

jslywgbw

jslywgbw1#

检查服务启动命令

/usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080

通过将--httpPort=8080更改为所需端口来编辑服务,然后调用daemon-reload并重新启动服务
此外,确保为该端口配置了安全组
此链接https://cdmana.com/2022/03/202203242138366513.html中有一个不同的修复程序,建议在/usr/lib/systemd/system/jenkins.service中编辑JENKINS_PORT,调用service jenkins start

相关问题