• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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