• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Portainer behind nginx reverse proxy

Gagi

New Pleskian
Hi,

i'm currently trying to run portainer on my VPS which is manged by plesk.

The portainer container (docker) is running on port 9000 and i would like to create nginx reverse proxy on one of my subdomains to forward the https requests as http request to portainer.

The container as such is working fine and i can access it using http://<domain>:9000

For the nginx setup i setup the new subdomain. Disabled nginx proxy mode in plesk and added the following rule (i also tried a lot of other rules without success):

Code:
location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://0.0.0.0:9000/;
    proxy_read_timeout 90;
}

The nginx doesn't seem to be working correctly, as i'm not getting: ERR_TOO_MANY_REDIRECTS on chrome and can see constant redirects to same https:// url using curl.

Did anyone tried to setup portainer behind nginx yet ? The alternative would be to run nginx or traefik inside a container as well and use a docker-compose file, but with that i can't easily reuse the wildcard certificates managed by plesk, can i ?

Thx
Gagi
 
Hi,

i found the solution to my problem and this needs to be done for every html page which should be proxied by nginx.

The problem is that nginx tries to deliver all index.html (and a few more) itself and doesn't forward the request in those cases. For the proxy to work, this needs to be disabled.

This can be done in the same hosting settings page. On the top select "Indexing files" -> "Own Value" -> Remove the content there and add a space (this is needed to save the change, otherwise it will just revert to the default again).

Gagi
 
Back
Top