Сannot access to local gitlab server from outside

I’m newbie in gitlab, tried to solve problem by myself for some weeks, now looking up for some help

I’v got a centos 7 physical server in local network of 2 computers and static ip

Installed gitlab on centos, forwarded 77 port on router

Since I don’t have a domain, my external_url is IP+port:

external_url 'http://123.456.78.90:77'

Added port in centos in iptables and firewall-cmd:

iptables -I INPUT -p tcp --dport 77 -m state --state NEW -j ACCEPT
firewall-cmd --zone=public --add-port=77/tcp --permanent

From inside the server I can get access to gitlab web interface by address

127.0.0.1:77

There I can see “Clone with HTTP” url in repository:

http://123.456.78.90:77/user/test.git

I go to another outside server and write

git remote add origin http://123.456.78.90:77/user/test.git
git add test.txt
git push origin master

And get

unable to access 'http://123.456.78.90:77/user/test.git/': Recv failure: Connection reset by peer

What did I miss?

Thanks for posting and welcome to the Community Forum, @CloudLegat!

I suspect either:

  • your server is configured to use an internal IP address, not external IP (does the ip start with 192., 172., 10., or 127.?
  • changing the port from default (80) to 77 didn’t work as expected, nginx is still using port 80
  • the port-forwarding rule didn’t successfuly poke a hole in your firewall to allow this system to be public-facing on the internet

A few questions to help troubleshoot:

Are you able to connect to 123.456.78.90 via curl or any other method from outside your Local Network? (tip: try curl -v 123.456.78.90:77 from any machine not on your local network)

If you run netstat -tulpn on the GitLab server, do you see nginx running on port 77 or port 80?

If you run gitlab-ctl tail, and reload the URL http://123.456.78.90:77 from a different machine, do you see any error messages in the logs?

Finally, can you confirm that you’re using an external, not internal IP address. (tip: try curl icanhazip.com on your GitLab server to get the external IP address, verify it matches output in ifconfig or ip a)

1 Like

Hello, and thank you for answering

My mistake was in forwarding on router to wrong internal port (22)

That’s how it works for me:
external port: 8686
internal port: 77
local ip: 192.168.0.202
protoclos: all

1 Like