Changing Nginx HTTP port without changing GitLab External URL

(Server : RedHat 6.4 - Gitlab Community Edition (Omnibus) 7.8.2 and 7.8.4)


In my GitLab server, I have other services running (SVN…) and I don’t want any service to use the 80 port.
Except a Apache front which proxy other services.
So I had to change the Nginx running port from 80 to 18090, but without changing the default external url (external_url ‘http://scm.staging.mycompany’).

It was ok with the GitLab Community Edition 7.7.1 (Omnibus package) by using a Nginx custom config:
Extract from my gitlab.rb file:

external_url ‘http://scm.staging.mycompany

nginx[‘custom_nginx_config’] = “include /etc/gitlab/nginx.conf;”

The custom nginx.conf file:

server {
listen 18090;

But, upgrading from 7.7.1 to the 7.8.2 (and also 7.8.4) Omnibus Gitlab, the custom config is not taken into account.
The 80 port is used, expect if I change the external_url which is not interesting.

I found that my Nginx custom conf was loaded from the /var/opt/gitlab/nginx/conf/nginx.conf file.
But it is included after another conf file : /var/opt/gitlab/nginx/conf/gitlab-http.conf
And the gitlab-http.conf set the Nginx port to 80.

As a turn-around I had to change manualy the generated gitlab-http.conf file to set the port to 18090.

Is this a bug ?
Is there another parameter in the gitlab.rb which can change the nginx port without changing the external url ?


FYI I see that the 7.9 version of GitLab have a new feature:
“Add custom listen_port to nginx config for reverse proxies”
This should correct this issue.