Change Jenkins Port on MacOS

2019-01-30 06:24发布

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条回答
可以哭但决不认输i
2楼-- · 2019-01-30 06:38

This worked for me for changing port to 7070 or other.

sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 7070

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

More info about this

查看更多
聊天终结者
3楼-- · 2019-01-30 06:40

it looks like the default way is:

#add the default parameters - this will edit /Library/Preferences/org.jenkins-ci.plist

sudo defaults write /Library/Preferences/org.jenkins-ci httpPort 7070

#stop

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

#start

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

查看更多
倾城 Initia
4楼-- · 2019-01-30 06:41

Just write the following command in the terminal:

sudo defaults write /Library/Preferences/org.jenkins-ci.plist httpPort 9999

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

That should resolve it.

查看更多
爷、活的狠高调
5楼-- · 2019-01-30 06:43

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)

查看更多
smile是对你的礼貌
6楼-- · 2019-01-30 06:53

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 type java -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.

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
查看更多
该账号已被封号
7楼-- · 2019-01-30 06:55

I have installed Jenkins on my Mac OS High Sierra using Brew.

Please follow below steps:

  1. You have to change the port to below file:

    /usr/local/Cellar/jenkins/2.x.x/homebrew.mxcl.jenkins.plist

  2. 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

  3. You also need to restart the Jenkins Server. using below brew service commands:

    $ brew services stop jenkins

    $ brew services start jenkins

That's all.!

查看更多
登录 后发表回答