我想知道如何更改 Jenkins 的默认端口 8080。使用 Linux 或 Windows,只需使用配置文件即可完成此操作。但是 Jenkins 的 Mac 配置文件看起来与其他的完全不同。
当然,可以在启动服务器时传递 --httpPort 参数,但我想在配置文件中执行此操作。
有这样的选择吗?
PS:通过apache传递Jenkins实例可以解决问题,但我想更改Jenkins端口。
谢谢!
I was wondering how one could change Jenkins' default port 8080. Using linux or windows, this is simply done with the configuration file. But the Mac config file of Jenkins looks completely different from the other ones.
Of course one could pass the --httpPort parameter when starting the server, but I want to do this within a config file.
Is there an option for that?
PS: Passing the Jenkins instance through apache would kinda solve the problem, but I want to change the Jenkins port.
Thanks!
发布评论
评论(7)
这对我将端口更改为 7070 或其他端口很有用。
有关此内容的更多信息
This worked for me for changing port to 7070 or other.
More info about this
我已使用 Brew 在我的 Mac OS High Sierra 上安装了 Jenkins。
请按照以下步骤操作:
<块引用>
/usr/local/Cellar/jenkins/2.xx/homebrew.mxcl.jenkins.plist
分配任何可用端口,例如 7070 或任何您想要的数字。[如果您有静态 IP,则可以指定端口 80(HTTP) ]
--httpPort=7070
您还需要重新启动 Jenkins 服务器。使用以下brew service命令:
$brew 服务停止詹金斯
$brew services start jenkins
就这样。!
I have installed Jenkins on my Mac OS High Sierra using Brew.
Please follow below steps:
Assign any free port like 7070 or any number you want.[If you have static IP then you can give port 80(HTTP)]
--httpPort=7070
You also need to restart the Jenkins Server. using below brew service commands:
$ brew services stop jenkins
$ brew services start jenkins
That's all.!
只需在终端中写入以下命令
即可解决该问题。
Just write the following command in the terminal:
That should resolve it.
在不同的 HTTP 端口(即 7070 和 7071)上运行两个 Jenkins 守护进程的另一种解决方案: 不同 HTTP 端口上的多个 Jenkins 守护进程 (Mac OS X)
An other solution in case of running two daemons of Jenkins, on different HTTP ports (i.e. 7070 and 7071) : Multiple Jenkins daemons on different HTTP ports (Mac OS X)
看起来默认方式是:
#add the defaultparameters - 这将编辑/Library/Preferences/org.jenkins-ci.plist
#stop
#start
it looks like the default way is:
#add the default parameters - this will edit /Library/Preferences/org.jenkins-ci.plist
#stop
#start
在macOS上修改Jenkins端口之前,必须注意Jenkins的安装方式。
如果你想处理iOS项目构建,这里我建议你通过“Homebrew”安装Jenkins,因为使用
.pkg
的方式安装可能会遇到一些错误,而且很难解决问题。我已经通过brew命令安装了Jenkins LTS:
brew install jenkins-lts
所以我的Jenkins plist文件在这里:
/usr/local/Cellar/jenkins-lts/2.121.2/homebrew.mxcl .jenkins-lts.plist
您可以将
httpPort
值从默认的8080
修改为其他值,然后保存文件。<代码>
<键>标签
<字符串>homebrew.mxcl.jenkins-lts
<数组>
<字符串>/usr/libexec/java_home
<字符串>-v
<字符串>1.8
<字符串>--exec
<字符串>java
<字符串>-Dmail.smtp.starttls.enable=true
<字符串>-jar
<字符串>/usr/local/opt/jenkins-lts/libexec/jenkins.war
<字符串>--httpListenAddress=127.0.0.1
<字符串>--httpPort=8383
<键>RunAtLoad
<真/>
sudo launchctl unload
命令对您不起作用。您必须尝试这些命令来重新启动 Jenkins 并使端口修改生效。<代码>
Brew 服务停止 jenkins-lts
酿造服务启动詹金斯-LTS
<代码>
ifeegoo:~ ifeegoo$ 酿造服务停止 jenkins-lts
停止`jenkins-lts`...(可能需要一段时间)
==>成功停止`jenkins-lts`(标签:homebrew.mxcl.jenkins-lts)
ifeegoo:~ ifeegoo$ 酿造服务启动 jenkins-lts
==>成功启动`jenkins-lts`(标签:homebrew.mxcl.jenkins-lts)
注意:如果你安装了Jenkins LTS,必须注意你的命令必须是
jenkins-lts
,而不是jenkins
。Before modify the Jenkins port on macOS,you must pay attention to the way of installation of Jenkins.
Here I recommend you install Jenkins by 'Homebrew' if you want to deal with iOS project building,because you may meet some errors that the way of using
.pkg
to install,it's really hard to solve the problems.I have installed Jenkins LTS by brew command:
brew install jenkins-lts
So my Jenkins plist file is here:
/usr/local/Cellar/jenkins-lts/2.121.2/homebrew.mxcl.jenkins-lts.plist
You can modify the
httpPort
value from default8080
to the other value,and then save the file.<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.jenkins-lts</string>
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/java_home</string>
<string>-v</string>
<string>1.8</string>
<string>--exec</string>
<string>java</string>
<string>-Dmail.smtp.starttls.enable=true</string>
<string>-jar</string>
<string>/usr/local/opt/jenkins-lts/libexec/jenkins.war</string>
<string>--httpListenAddress=127.0.0.1</string>
<string>--httpPort=8383</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
sudo launchctl unload
command will not work for you.You must try these commands to restart your Jenkins and make the port modification works.brew services stop jenkins-lts
brew services start jenkins-lts
ifeegoo:~ ifeegoo$ brew services stop jenkins-lts
Stopping `jenkins-lts`... (might take a while)
==> Successfully stopped `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
ifeegoo:~ ifeegoo$ brew services start jenkins-lts
==> Successfully started `jenkins-lts` (label: homebrew.mxcl.jenkins-lts)
Note:If you installed Jenkins LTS,you must pay attention that your command must be
jenkins-lts
,notjenkins
.我将引导您完成它:
cd /Applications/Jenkins
sudo vi winstone.properties
将
httpPort=9999
添加到文件中。要查看可以放入其中的所有选项,请输入java -jar jenkins.war --help
从
/Applications/Jenkins< 运行
java -jar jenkins.war
/代码>。您的端口将被更改。默认情况下,jenkins.war
从./winstone.properties
获取配置选项。I'll walk you through it:
cd /Applications/Jenkins
sudo vi winstone.properties
Add
httpPort=9999
to the file. To see all the options you can put in there typejava -jar jenkins.war --help
run
java -jar jenkins.war
from/Applications/Jenkins
. Your port will be changed.jenkins.war
picks up config options from./winstone.properties
by default.