We have a linux PC that we have docker running multiple applications.
The docker is managed by Portainer and we have setup a reverse proxy using Nginx.
We have server applications running already such as git, duplicati (linux back up) and next cloud.
Also those applications are working well with the reverse proxy.
We want to add another server container for Redmine server but I am having a problem with it connected to the Nginx reverse proxy.
In the docker-compose for Redmine, if I define ports, it exposes the port and I can access the Redmine server container by http://localhost:3000. However, when I setup the reverse proxy for this in Nginx, the host name I specify never goes anywhere (ie. “redmine.mycompany.local:3000”).
Can someone please help me in diagnosing this issue?
If I expose the port 3000 and I call netstat -tulp I can see 3000 is listened but when I don’t expose it, it disappears.
I feel like it’s an issue with containers networks but I am new to docker so I don’t know how to go about diagnosing the issue.
Any pointers will be great!
Please share how you start your nginx and redmine container. Furthermore, share the nginx config file as well, so we can actually see what you do and how you do it, so we can get an idea what might need to be done differently.
It appears this file is mounted as a volume in the proxy service. It listens on port 80 and acts if the proxy is accessed using the url http://redminelatest.mycompany.local.
To get an understanding how you actually proxy the requests to the backend, we need to see the two includes as well.
I assume you do set the variables in the head of the server block and re-use them inside the includes?
Below is the proxy.conf.
I can’t find the other file as there is no custom folder under /data/nginx/.
The other thing we were thinking of was what if a different container was using also port 3000, would Nginx be able to handle that?
I would have thought that should not be a problem since it should handle the network from different containers… Am not sure how to diagnose the docker network (nginx_network).
Any pointers would be great.
Also if you need any other info, let me know!
I assume the nginx configuration is rendered by nginx-proxy-manager based on configurations done in the ui, so I assume declaring $server and $port does not override required values. Furthermore, I am not sure if $request_uri really is required or even might cause problems.
The incoming request on port 80 uses the reverse proxy rule based on the domain name. The proxy itself uses the service name and container port to forward the request. The proxy and redmine container share a network, so incoming requests should be proxied to redmine. The “plumbing” look correct.
You can copy the nginx logs from the container to your host and inspect them with a editor/viewer of your choice:
Why would different proxy rules to different target containers on the same target port create problems?
Nginx doesn’t care and is not affected by this → Of course it can handle it.
As you say I set all the variables ($forward_scheme, $server and $port) from the nginx UI.
It turns out that the both access and error logs are empty for the redminelatest container. The files exist but nothing in it (size is 0 bytes).
Does that indicate that the nginx proxy host for redmine is not working at all?
What else can I try?
I can bash into the nginx container to see what’s going on…
It appears like it. I would have expected traces indicating access or at least errors.
Does the domain redminelatest.mycompany.local really resolve to the docker host, where the proxy is running? The server block will only listen if it is access by the domain specified in server_name, it will not react if the docker host’s ip or hostname or even a different domain name that resolves to the host is used.
I don’t use it npm, so I can’t really tell how it needs to be configured. Since the nginx conf looks okay, are you sure there is no “enable rule” button or the requirement to reload the config or restart the nginx service.