How to start jenkins on different port rather than 8080 using command prompt in Windows?
Solution 1
Use the following command at command prompt:
java -jar jenkins.war --httpPort=9090
If you want to use https use the following command:
java -jar jenkins.war --httpsPort=9090
Details are here
Solution 2
Open the jenkins.xml
in the jenkins home folder (usually C:\Program Files (x86)\Jenkins
) and change the port number:
httpPort=xxxx
to
httpPort=yyyy
then restart the service. it should change the setting permanently.
Solution 3
With Ubuntu 14.4 I had to change the file /etc/default/jenkins
E.g.
#HTTP_PORT=8080
HTTP_PORT=8083
and restart the service
service jenkins restart
Solution 4
In CentOS/RedHat (assuming you installed the jenkins
package)
vim /etc/sysconfig/jenkins
....
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8080"
change it to any port you want.
Solution 5
On Windows (with Windows Service).
Edit the file C:\Program Files (x86)\Jenkins\jenkins.xml
with 8083 if you want 8083 port.
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8083</arguments>
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 26, 2021Comments
-
Admin almost 3 years
I have jenkins.war and I started it from command prompt in Windows as:
java -jar jenkins.war
It was started well and easily browsed as
http://localhost:8080
I want to start on 9090 port. How can I do that?
-
null over 10 yearsHi, I did this but after a reboot it reverted to 8080 again, is there a way to change the setting permanently?
-
Christian about 10 years@SteveGreen: The above mentioned commands are starting Jenkins from the command line. This is not a permant configuration. It is possible to save this command in a batch file and launch that file during startup, e.g. in an autostart folder.
-
adarshr almost 10 yearsJust restarting the service should suffice.
-
Spartan almost 10 years1. There is no /etc directory in Windows. 2. This is only a check if the port is already in use. You can change it in Ubuntu/Debian in /etc/default/jenkins: HTTP_PORT=9090
-
Erik almost 10 yearsI do not see this file
-
Marian Klühspies over 9 yearssadly this seems to not have any effect.it still says fail, port 8080 in use when I change to another port
-
Travis about 9 yearsMight be worth pointing out that 'jenkins.xml' is the one located in the same folder as jenkins.exe. Not the one that you may have copied to folder pointed to by environment variable 'JENKINS_HOME'
-
Oscar Barrett over 8 yearsThis file was called
jenkins.model.JenkinsLocationConfiguration.xml
for me. -
Jubl about 8 yearsI would like to add that if you are not able to edit the jenkins.xml file on Windows for some reason, drag the file to your desktop. It will let you edit it there. Once you make the changes, drag the file back into the installation directory and restart the service. Big thanks to Prasad for the answer.
-
blackcompe almost 6 years@Jubl: You're a lifesaver! Despite changing the default instance port upon initial Jenkins configuration, verifying that
jenkins.xml
had the correcthttpPort
, and restarting the Windows service, it still didn't work. Dragging the file to my desktop (which then reverted the default port back to 8080), editing it, putting it back into the installation folder, and then restarting the service made it work. -
Ashish Kamble over 5 yearsIt lefts old 8080 and now new 9090 both are working now
-
Ashish Kamble over 5 years@RiponAlWasim is it standard way if i use
net start jenkins
command to start/stop jenkins services. -
vljs about 5 yearsWorks on Ubuntu 18.04 too
-
Dinu Nicolae almost 5 yearsit does not work for me. Jenkins refuses to start on any port except for 8080.
-
Dinu Nicolae almost 5 yearsIt was my bad, it works. I had no Custom TCP Rule on aws for the other port. Thank you.
-
serge3ling about 4 years
sudo systemctl restart jenkins
restarts the service, too. -
Darryl RN over 3 yearsI changed the port to 80 (because it is not being used by any program), but after i restart the service, the status is active but I can't open it from browser. Do you know what's wrong?
-
manukyanv07 over 2 yearsThis is not working in amazon linux instance. I changed the port restarted jenkins but still listening to same port.