Invalid nginx config for registry with custom nginx port
GitLab 8.8.3 omnibus package on Ubuntu 16.04
We have this in our /etc/gitlab/gitlab.rb
nginx['listen_port'] = 80
nginx['listen_https'] = 'false'
and
gitlab_rails['registry_enabled'] = true
gitlab_rails['registry_host'] = "ourdomain.xyz"
gitlab_rails['registry_port'] = "7443"
gitlab_rails['registry_api_url'] = "http://ourdomain.xyz:5000"
registry['enable'] = true
(we have disabled https on gitlab side because our gitlab is behind loadbalancer)
With this gitlab generates this nginx config
1 # This file is managed by gitlab-ctl. Manual changes will be
2 # erased! To change the contents below, edit /etc/gitlab/gitlab.rb
3 # and run `sudo gitlab-ctl reconfigure`.
4
5 ## Lines starting with two hashes (##) are comments with information.
6 ## Lines starting with one hash (#) are configuration parameters that can be uncommented.
7 ##
8 ###################################
9 ## configuration ##
10 ###################################
11
12 ## Redirects all HTTP traffic to the HTTPS host
13 server {
14 listen *:80;
15 server_name gitlab.minion.tools;
16 server_tokens off; ## Don't show the nginx version number, a security best practice
17 return 301 https://$http_host:$request_uri;
18 access_log /var/log/gitlab/nginx/gitlab_registry_access.log gitlab_access;
19 error_log /var/log/gitlab/nginx/gitlab_registry_error.log;
20 }
21
22 server {
23 listen *:;
24 server_name gitlab.minion.tools;
25 server_tokens off; ## Don't show the nginx version number, a security best practice
26
27 client_max_body_size 0;
28 chunked_transfer_encoding on;
29
30
31 access_log /var/log/gitlab/nginx/gitlab_registry_access.log gitlab_access;
32 error_log /var/log/gitlab/nginx/gitlab_registry_error.log;
33
34 location / {
35 proxy_set_header Host $http_host; # required for docker client's sake
36 proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
37 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
38 proxy_set_header X-Forwarded-Proto $scheme;
39 proxy_read_timeout 900;
40
41 proxy_pass http://;
42 }
43
44
45 }
It contains error 2016/06/08 03:09:57 [emerg] 23845#0: invalid port in "*:" of the "listen" directive in /var/opt/gitlab/nginx/conf/gitlab-registry.conf:23.