I have a gitea server listening on public IP 111.222.333.444
, port 3000. If I open http://111.222.333.444:3000
on my browser, I can access normally.
I have an nginx server running on 999.888.777.666
. I have domain registered, and the DNS specifies that mysubdomain.example.com
points to 999.888.777.666
.
In the nginx server config, I have included the following entrance:
server {
listen 80;
server_name mysubdomain.example.com;
location / {
proxy_pass http://111.222.333.444:3000;
proxy_set_header Host $host;
proxy_redirect off;
}
}
If I access http://mysubdomain.example.com
through my browser, I can't access my gitea server. But, if I access http://mysubdomain.example.com:3000
, I can successfully reach the server.
Actually, I can remove the port from the nginx config and leave it like this, and my browser experience remains unchanged:
server {
listen 80;
server_name mysubdomain.example.com;
location / {
proxy_pass http://111.222.333.444;
proxy_set_header Host $host;
proxy_redirect off;
}
}
Why is this happening?
An additional note: I have other reverse proxies set up in this same nginx server in the same fashion that work just fine, with no need to specify the port on top of the subdomain.
What am I doing wrong? What should I change to be able to reach my gitea server on http://mysubdomain.example.com
with no need to specify the port?