在 macOS 上更改 Jenkins 端口 [英] Change Jenkins port on macOS
问题描述
我想知道如何更改 Jenkins 的默认端口 8080.使用 linux 或 windows,这只需通过配置文件即可完成.但是Jenkins的Mac配置文件看起来和其他的完全不同.
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.
当然可以在启动服务器时传递 --httpPort 参数,但我想在配置文件中执行此操作.
Of course one could pass the --httpPort parameter when starting the server, but I want to do this within a config file.
有这样的选择吗?
PS:通过 apache 传递 Jenkins 实例可以解决问题,但我想更改 Jenkins 端口.
PS: Passing the Jenkins instance through apache would kinda solve the problem, but I want to change the Jenkins port.
谢谢!
推荐答案
我会带你完成它:
cd/Applications/Jenkins
sudo vi winstone.properties
将 httpPort=9999
添加到文件中.要查看您可以输入的所有选项,请键入 java -jar jenkins.war --help
cd /Applications/Jenkins
sudo vi winstone.properties
Add httpPort=9999
to the file. To see all the options you can put in there type java -jar jenkins.war --help
从 /Applications/Jenkins
运行 java -jar jenkins.war
.您的端口将被更改.jenkins.war
默认从 ./winstone.properties
中选取配置选项.
run java -jar jenkins.war
from /Applications/Jenkins
. Your port will be changed. jenkins.war
picks up config options from ./winstone.properties
by default.
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ pwd
/Applications/Jenkins
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ ls -al
total 87928
drwxr-xr-x 4 root wheel 136 Aug 21 12:32 .
drwxrwxr-x+ 83 root admin 2822 Aug 21 12:05 ..
-rwxr-xr-x 1 root wheel 45014470 Aug 19 13:14 jenkins.war
-rw-r--r-- 1 root wheel 14 Aug 21 12:32 winstone.properties
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ sudo cat winstone.properties
httpPort=9494
Andrew-Finnells-MacBook-Pro:Jenkins afinnell$ java -jar jenkins.war
Running from: /Applications/Jenkins/jenkins.war
webroot: $user.home/.jenkins
[Winstone 2011/08/21 12:33:19] - Beginning extraction from war file
Jenkins home directory: /Users/afinnell/.jenkins found at: $user.home/.jenkins
[Winstone 2011/08/21 12:33:21] - HTTP Listener started: port=9494
这篇关于在 macOS 上更改 Jenkins 端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!