Comprehensive Guide to Configuring Jenkins Service Port via Command Line in Windows

Nov 22, 2025 · Programming · 10 views · 7.8

Keywords: Jenkins | Port Configuration | Command Line Parameters | Windows System | Reverse Proxy

Abstract: This article provides a detailed exploration of multiple methods for modifying Jenkins default port configuration when starting via command line in Windows environment. The core solution using --httpPort parameter is thoroughly analyzed, while alternative approaches through configuration file modifications for persistent settings are compared. Special requirements for low port number scenarios (such as port 80) are discussed in depth, along with technical implementation details of reverse proxy configurations. Complete code examples and configuration instructions help users comprehensively master all aspects of Jenkins port configuration.

Fundamental Principles of Jenkins Port Configuration

As a Java-based web application, Jenkins follows standard web server configuration patterns for port binding. When started via java -jar jenkins.war command, Jenkins defaults to listening on port 8080, which is a common default configuration for most Java web applications.

Command Line Parameter Configuration

The most direct and effective method for port modification is through startup parameters. Jenkins provides dedicated --httpPort parameter to specify HTTP service port:

java -jar jenkins.war --httpPort=9090

This command binds Jenkins service to port 9090, allowing access through http://localhost:9090. For scenarios requiring HTTPS encrypted communication, the --httpsPort parameter can be used:

java -jar jenkins.war --httpsPort=9090

Persistent Configuration via Files

Beyond temporary command line parameters, Jenkins supports persistent port settings through configuration files. In Windows systems, this primarily involves the following configuration files:

Jenkins Service Configuration File: The jenkins.xml file located in C:\Program Files (x86)\Jenkins directory. Modifying the httpPort parameter value enables permanent port changes:

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=9090</arguments>

After modification, restarting the Jenkins service is required for the configuration to take effect.

Cross-Platform Configuration Differences

Significant differences exist in Jenkins port configuration across different operating systems:

Special Handling for Low Port Numbers

When binding Jenkins to low port numbers like 80, system permission restrictions become a concern. Since ports below 1024 are system-reserved, regular user processes cannot bind directly. In such cases, reverse proxy solutions can be employed:

IIS Reverse Proxy Configuration Steps:

  1. Maintain Jenkins running on default port 8080
  2. Install IIS URL Rewrite module and Application Request Routing module
  3. Create virtual website bound to port 80
  4. Configure reverse proxy inbound rules to redirect port 80 requests to port 8080

This approach resolves port permission issues while maintaining service availability, as users accessing port 80 are transparently redirected to the actual Jenkins service port.

Configuration Verification and Troubleshooting

After completing port configuration, the following verification steps are recommended:

When encountering port binding failures, common causes include: port already in use, firewall blocking, insufficient permissions, etc. Troubleshooting should be performed based on specific error messages.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.