Nginx requests on port 80 go to 8081 but

I have set up gitlab on port 8081 and have tweaked my nginx to redirect 80 requests to 8081 which is working great

server {
    listen 217.147.85.86:80;
    listen [::]:8081 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;
    server_name gitlab.adamprocter.co.uk;

    location / {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_redirect off;
       proxy_pass http://gitlab;
    }
}

But when I create a new project or try to use a runner - it still refers to port 8081 which messes things up, is there any other settings I could adjust to make this work?

hope that makes some sense

Hi

unable to understand the issue… [quote=“adamprocter, post:1, topic:3685”]
I have set up gitlab on port 8081
[/quote]

ok

ok

then what is the problem ? where you want them to redirect to ?

it seems to mean if I set up a runner or try to connect xcode to gitlab connection is refused as the projects etc still use 8081 in the url etc

I wonder what I need to do to stop that as the address as listed in the project doesnt work as the 8081 has been stripped ?

http://gitlab.adamprocter.co.uk:8081/adamprocter/hello-world - doesnt work
http://gitlab.adamprocter.co.uk/adamprocter/hello-world - does

did that make any sense ?

The root problem in this question is the same as your other question that I just replied to.

If you post your complete (except for passwords/keys, which you can replace with something else) config files for GitLab and Nginx, I will help you fix them…

1 Like

Thanks I am still stuck on this : here is my nginx

upstream gitlab {
    server unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
 }

upstream gitlab-git-http-server {
server localhost:8081;
}

server {
    listen 217.147.85.86:80;
    listen [::]:8081 default_server ipv6only=on;

location /.well-known/acme-challenge/ {
proxy_pass http://gitlab.adamprocter.co.uk:8081;
}


    root /usr/share/nginx/html;
    index index.html index.htm;
    server_name gitlab.adamprocter.co.uk;

    location / {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_redirect off;
       proxy_pass http://gitlab;
    }
}

and here is my gitlab.rb

nginx['enable'] = false
## gitlab_git_http_server['listen_network'] = "tcp"
## gitlab_git_http_server['listen_addr'] = "localhost:8081"

external_url 'http://gitlab.adamprocter.co.uk:8081'
web_server['external_users'] = ['nginx']
gitlab_rails['trusted_proxies'] = [ '192.168.1.0/24', '192.168.2.1', '2001:0db8::/32' ]

I also tried to add SSL via letsencrypt which I thought might help but the 8081 issue also messes the set up for that too however at the moment I just want to be able to connect via a runner so I can hopefully start to upload my code :smiley:

Let’s continue this in only one place. I’m going to reply in the other question.

1 Like