Gitlab Omnibus – Change the Nginx Port

Ignore original text below. The correct method is to amend the /etc/gitlab/gitlab.rb file with the port e.g.:

external_url “https://gitlab.domain.co.uk:8443”
nginx[‘ssl_certificate’] = “/etc/pki/tls/certs/pubkey.pem”
nginx[‘ssl_certificate_key’] = “/etc/pki/tls/private/privkey.pem”

Then run:

gitlab-ctl reconfigure

 

Doing a ps -ef | grep nginx allowed me to track down the configuration file:

/var/opt/gitlab/nginx/etc/gitlab-http.conf

That file specified the port number (see below) and can be changed:

server {
listen *:8181 default_server;         # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name servername.company.co.uk;     # e.g., server_name source.example.com;
server_tokens off;     # don't show the version number, a security best practice
root /opt/gitlab/embedded/service/gitlab-rails/public;

Restart gitlab:

gitlab-ctl restart

 

 

One Response to “Gitlab Omnibus – Change the Nginx Port”

  1. Katsuro Kurosaki

    Finally! A simple, neat, working solution to enable SSL and change default port on gitlab! Thank you very much, you made my day 😀
    Best regards!

    Reply

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>