Skip to content

Connection Refused When Trying to access Self Hosted Gitlab

Summary

I recently just installed GitLab Omnibus on an Ubuntu server. It was working fine I was able to have my teammates create accounts and i was successfully able to migrate some of our repositories.

But I decided to setup the SMTP, following the instructions provided in the gitlab documentation, i could no longer access gitlab through my browser. error thrown is refused to connect. although when i curl localhost inside my server i see that i am being redirected to the login page. i am also sure that the setup worked because i was able to receive an email regarding one of my pipelines failing. so it must have something to do with the NGINX setup

when i ran reconfigure for the first time after adding the smtp settings. it threw an error because i was using a static ip which meant i could not be granted a certificate. so i had to change the https to http before running reconfigure again. i did not expect this to happen because i did sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ee during installation but with http://<myip>, which i thought would save the proper configs. i was expecting that i would not have to change any of my gitlab.rb configs except those specified in the smtp setup guide.

here is some information. i have also verified that my server allows access to its ports. also i was already able to access gitlab previously anyway.

Steps to reproduce

  1. Follow Ubuntu Install Guide
  • I am using a t2.medium on AWS with an elastic IP i allowed access to http and https ports from anywhere
  • Skip the installation of postfix
  • during sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ee use a the elastic IP with http
  • Verify that it is working by accessing Gitlab in the browser
  1. Follow SMTP Setup Instructions
  • used GMail with a google app password
  1. Try to Access Gitlab on the browser. "Connection Refused"

What is the current bug behavior?

  • Error Connection Refused
  • The error thrown is not a gitlab screen so i know this is probably an error with the NGINX setup
  • I can curl the localhost from the server and i can see that gitlab is running
  • I can access http:///users/sign_in if i specifically type that url most likely because when i just type the IP it redirects to HTTPS. note: this was not a problem after my installation
  • Once signed in i get error 422 and i cannot proceed.

What is the expected correct behavior?

  • Access to gitlab through browser is available.

Relevant logs

run: alertmanager: (pid 22834) 1333s; run: log: (pid 13532) 20409s
run: crond: (pid 22844) 1332s; run: log: (pid 24265) 20160s
run: gitaly: (pid 22853) 1332s; run: log: (pid 12915) 20522s
run: gitlab-exporter: (pid 22873) 1331s; run: log: (pid 13446) 20427s
run: gitlab-workhorse: (pid 22881) 1331s; run: log: (pid 13305) 20456s
run: grafana: (pid 22893) 1331s; run: log: (pid 13811) 20362s
run: logrotate: (pid 22903) 1330s; run: log: (pid 13359) 20440s
run: nginx: (pid 23878) 968s; run: log: (pid 13324) 20450s
run: node-exporter: (pid 22915) 1329s; run: log: (pid 13423) 20433s
run: postgres-exporter: (pid 22921) 1329s; run: log: (pid 13613) 20403s
run: postgresql: (pid 22927) 1328s; run: log: (pid 13101) 20514s
run: prometheus: (pid 22974) 1328s; run: log: (pid 13494) 20415s
run: redis: (pid 23022) 1328s; run: log: (pid 12880) 20528s
run: redis-exporter: (pid 23026) 1327s; run: log: (pid 13465) 20421s
run: sidekiq: (pid 23032) 1327s; run: log: (pid 13278) 20462s
run: unicorn: (pid 23039) 1326s; run: log: (pid 13254) 20468s
1082:# nginx['enable'] = true
1369:# pages_nginx['enable'] = false
1430:# mattermost_nginx['enable'] = false
1456:# registry_nginx['enable'] = false
sudo ss -ntlp | grep nginx
LISTEN   0         511                 0.0.0.0:80               0.0.0.0:*        users:(("nginx",pid=23880,fd=7),("nginx",pid=23879,fd=7),("nginx",pid=23878,fd=7))
LISTEN   0         511                 0.0.0.0:8060             0.0.0.0:*        users:(("nginx",pid=23880,fd=8),("nginx",pid=23879,fd=8),("nginx",pid=23878,fd=8))
  • i noticed that my /var/opt/gitlab/nginx/conf/gitlab-http.conf does not have
server {
  listen *:443 ssl http2;
  ...
}
  • should how should i add this manually? or is there a config to set in gitlab.rb

Environment details

  • Operating System: Ubuntu 16.04
  • Installation Target, remove incorrect values:
    • VM: AWS
  • Installation Type, remove incorrect values:
    • New Installation
  • Is there any other software running on the machine: NO
  • Is this a single or multiple node installation? SINGLE
  • Resources
    • t3a.medium

Configuration details

  • i removed the SMTP setup but still same result
Provide the relevant sections of `/etc/gitlab/gitlab.rb`

external_url 'http://my.ip.here'

Edited by mio gomez