Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set custom listening port for custom location #3024

Open
gutleib opened this issue Jun 28, 2023 · 3 comments
Open

How to set custom listening port for custom location #3024

gutleib opened this issue Jun 28, 2023 · 3 comments
Labels

Comments

@gutleib
Copy link

gutleib commented Jun 28, 2023

Hi, and excuse me for opening an issue.

There's a question that seems to pop up regularly in my tasks. I need to create service on a custom port for on the main Proxy Host that will lead to some other service. For example, I have a Gitlab service behind Nginx Proxy Manager, and I want to run Gitlab container registry on the same site name, but on a different port. On the backend, they can be on different hosts, but on a front end I want them to be in the same location, /, but on different ports.
I beleive, I should configure that in Custom locations, but every time I do, main (443 port) service breaks.

Though this is not your issue per se, it seems to have no searchable answer for such a trivial need. Could you give some example of Custom location on Custom port configuration?

@bab1ch
Copy link

bab1ch commented Aug 23, 2023

@gutleib Have you found any solution for this? I'm facing the exact same issue for the GitLab container registry.

@bab1ch
Copy link

bab1ch commented Aug 27, 2023

For future reference, here is to solution: go to Host - Stream and configure any incoming port and forwarding host and port.

If you're using Docker image, be sure to add ports you're going to use in yaml file.

# This is part of docker-compose.yaml file 
ports:
      # These ports are in format <host-port>:<container-port>
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      - '3210:3210' # Git SSH | TCP (SSH) through proxy
      - '1234:1234' # GitLab Container Registry (only if GitLab accepts HTTPS)

In this example, TCP (SSH) connection is being passed through a reverse proxy. Just add Stream (port 3210) to your SSH server (port 3210 on GitLab machine)

You can add a stream for the GitLab Container registry, but your GitLab needs to accept HTTPS connection. If you're using a reverse proxy, good changes are you want your reverse proxy to provide TLS termination, thus GitLab accepting only HTTP. Create a subdomain for the container registry (e.g. registry.gitlab-domain.com), point it to reverse proxy, and just add a standard Proxy Host entry for the registry with the desired SSL certificate pointing to GitLab IP and configured port (1234).

Settings in GitLab

# This is part of gitlab.rb
gitlab_rails['gitlab_shell_ssh_port'] = 3210
registry_external_ulr `https://registry.gitlab-domain.com`
registry_nginx['enable'] = true
registry_nginx['listen_port'] = 1234

Copy link

Issue is now considered stale. If you want to keep it open, please comment 👍

@github-actions github-actions bot added the stale label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants