I'm a newbie at configuring servers and networks and I just recently installed Ubuntu Server on an old laptop to work on. The server currently has Jenkins, GitLab and Apache2 installed.

I can successfully log-in to GitLab by going to server.lan - and it redirects me to server.lan/users/sign_in - but to access Jenkins I have to type server.lan:8081. I had to change the port to avoid conflicts with GitLab.

So is there a way that I can access these services by typing server.lan/jenkins or server.lan/gitlab and make them work from there? All the answers I can find is about port and IP redirection and most of them have no answers at all.

My /etc/hosts file:       localhost       COMPAQ.lan      COMPAQ

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters    server.lan

Thanks in advance!

Just checked this article on GitLab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/nginx.md#using-a-non-bundled-web-server but with no luck

  • It's difficult to make gitlab work on foo.bar/gitlab instead of foo.bar/. You'd be better off using different domains for both: git.server.lan, ci.server.lan, but Gitlab already has a CI, so you probably don't need Jenkins at all.
    – muru
    Jul 28, 2017 at 2:59
  • @muru thanks man! I'm still learning the ropes here... I just managed to make gitlab work on foo.bar/gitlab but it's still listening on the port 8080. If I go to foo.bar/jenkins I get a 404 from gitlab, so I'm gessing I need to use something to filter the ports. I'll have to investigate more on GitLab's CI. Thanks for the tip! :)
    – E. Vidal
    Jul 28, 2017 at 3:51

1 Answer 1


For changing Jenkins Port


java -jar jenkins.war --httpPort=9090


java -jar jenkins.war --httpsPort=9090


This will work only temporaly (for testing). To make the change permanent do

  1. /etc/default/jenkins
  2. Find the line HTTP_PORT=8080 and change it to your needs
  3. restart jenkins sudo service jenkins restart


For changing Gitlab Port


  1. sudo -e /etc/gitlab gitlab.rb
  2. Change external_url from yourdomain.com to yourdomain.com:9999

    9999 -> Port you want it to run

    (instead of changing the port here you could also try to directly add the path like yourdomain.com/gitlab but I'm not sure this works)

  3. gitlab-ctl reconfigure


I would prefer changing the Jenkins port because more usual user want to access Gitlab just by entering the domain name maybe while for Jenkins probably only few administrators need access. Let those use the domain+port or domain/jenkins if you prefer so.

  • Just finished configuring that. Now I can access GitLab using server.lan which redirects me to the GitLab login page and I changed Jenkins port to avoid conflicts so now I'm accessing Jenkins using it's port on server.lan:8081. Thanks @derHugo! :)
    – E. Vidal
    Jul 28, 2017 at 13:58
  • Glad to help you :) Feel free to mark the answer as accepted so people also now your questions is solved already
    – derHugo
    Jul 28, 2017 at 14:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .