How do I change gitlab's default port 80 to a custom port number?
There are two approaches I've tried:
Set the port in /etc/gitlab/gitlab.rb
external_port "8888"
Then run reconfigure:
gitlab-ctl reconfigure
Set port in /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
production: &base
#
# 1. GitLab app settings
# ==========================
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: gitlab.blitting.com
port: 8888
https: false
Then restart gitlab
gitlab-ctl stop
gitlab-ctl start
With both of these, gitlab continues to run on the default 80 port number.
Chad Carbert answer still applies but just want to add extra for version 7.0.0.
Open "/etc/gitlab/gitlab.rb" in your text editor where currently I have external_url
http://127.0.0.1/
or similar to that. I may need to change external_url with dns including port number (eg. 'http://gitlab.com.local:81/') then reconfigure using command "sudo gitlab-ctl reconfigure" Gitlab is now working on port 81.Step by step:
sudo -e /etc/gitlab/gitlab.rb
yourdomain.com
toyourdomain.com:9999
9999
-> Port you want it to runsudo gitlab-ctl reconfigure
Very simple way to change defaults port number
Edit the file in centos or linux:
/var/opt/gitlab/nginx/conf/gitlab-http.conf
Change
listen *:80;
to what you want Ex:-90
Then
Don't run the command:
gitlab-ctl reconfigure
If
gitlab-ctl reconfigure
it configured gitlab by defaults and remove changes.So only run:
gitlab-ctl start
I'm also having this same issue. I don't have my
gitlab.rb
in the same location as you, but do have it installed via dpkg at the/opt
path you mentioned.If you've installed it via the package, all self-contained in that
/opt
directory, then you might find changing the port at :/opt/gitlab/embedded/conf/nginx.conf
/opt/gitlab/embedded/cookbooks/gitlab/templates/default/nginx-gitlab-http.conf.erb
Issue #6581: .deb package install on Ubuntu 12.04 - Port number in gitlab.yml file is ignored
With Ubuntu 17.04 and gitlab-ce 9.2.2, on local network
These steps worked for me:
gitlab.rb
file.sudo nano /etc/gitlab/gitlab.rb
nginx['listen_port'] = 8181
sudo service apache2 stop sudo gitlab-ctl reconfigure
sudo service apache2 start
'http://localhost:8181'
My main issue was that new users were not getting the custom port number in the emails that the system sent. Otherwise, manually writing the custom port in the address bar led users to the Gitlab install.
I did this install on Ubuntu 14.04 instead of the Omnibus. So somehow I don't have
gitlab-ctl
. (It exists in/usr/bin
, but the target of the symlink wasn't installed somehow. I'll fix that separately if I really have to.)Anyway, I used a variant of the second approach, writing the correct port into
/home/git/gitlab/config/gitlab.yml
:Since I don't have
gitlab-ctl
, I usedservice
:That worked for me. New users that I sent the email to received a link which contained the correct URL.
In Amazon Linux using the Centos 6 package I had to configure the file:
and then do the
command to finally get the port change.
I'm using Gitlab 7.5.3 omnibus 5.2.1 ci on Debian Squeeze. To change the default port for nginx add the _gitlab_port_ to /etc/gitlab/gitlab.rb:
My /etc/gitlab/gitlab.rb:
After changing the port, you have to call
gitlab-ctl reconfigure
andgitlab-ctl restart
in your command line.You must change the external_url value on Gitlab configuration file.
Follow these steps:
? If you use the webserver like Nginx you must change the external port from the reverse proxy in the configuration of Nginx.