SSH connection refused - gitea and nginx on different hosts

I have installed gitea using binary install.

I am able to get access ssh via LAN ip and able to authenticate successfully.
However, I am unable to get SSH access over my domain and getting the following error:

ssh -T -p 8523
ssh: connect to host port 8523: Connection refused

My nginx server ( is on a different host than my gitea host ( My DNS A record points to the nginx server. I am able to get SSH working when I change the DNS A Record to point my gitea host I am able to authenticate via SSH, however, webUI stops working. I have already setup port forwarding on my router to direct traffic to gitea host when using port 8523 (ssh port)

I need to keep the A record point to nginx host so that the webUI is accessible. Any idea on how I can address this issue?

See my app.ini config:

APP_NAME = CompanyName
RUN_USER = git
RUN_MODE = prod

DB_TYPE  = postgres
HOST     =
NAME     = gitea
USER     = gitea
PASSWD   = <redacted>
SSL_MODE = disable
CHARSET  = utf8
PATH     = /var/lib/gitea/data/gitea.db
LOG_SQL  = false

ROOT = /var/lib/gitea/data/gitea-repositories

SSH_DOMAIN       =
DOMAIN           =
HTTP_PORT        = 3000
ROOT_URL         =
DISABLE_SSH      = false
SSH_PORT         = 22
LFS_JWT_SECRET   = <redacted>
OFFLINE_MODE     = false
SSH_USER         = git

My Nginx proxy conf:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name gitea.*;

    include /config/nginx/sslsimple.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app;
        set $upstream_port 3000;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

Create a second subdomain for the second machine, and SSH using that.

1 Like

That works, I created a new subdomain and setup a URL Rewrite to point to my gitea host and updated my app.ini to the appropriate SSH_DOMAIN and it works! Thank you!