Sugan
Sugan

Reputation: 455

How to customize the Jenkins url without port number in linux

I have a jenkins server as http://domainname.com:8080 i want that to be changed to http://domainname.com/jenkins

I am not sure in linux how to achieve this. URL rewrite seems to be solution for windows.

Upvotes: 2

Views: 1919

Answers (3)

Raghu
Raghu

Reputation: 1

You can redirect the default http port 80 traffic to Jenkins http port 8080 through ip tables.

Following are the sample commands:

iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080

Upvotes: 0

Alex O
Alex O

Reputation: 8164

If you do not want the port number to be part of the URL, then you must ensure Jenkins listens on the default port (ie, 80 for http). Use --httpPort for this.

Another option is setting up a reverse proxy (listening on port 80) which forwards requests to Jenkins.

Upvotes: 3

Oliver Gondža
Oliver Gondža

Reputation: 3511

Jenkins can be told explicitly on which point it should be listening on. See --httpPort and --httpsPort on project wiki. Note that when you are running Jenkins in a managed environment (service daemon, docker container, etc.) they likely have way to configure those explicitly.

The reason why Jenkins (and in fact many other Java apps) favors 8080 is it is permitted to be used without any extra priviledges that are required for <1024 ports.

Upvotes: 1

Related Questions