WordPress installed with Docker and NPM – 502 Bad Gateway

When I installed WordPress using Docker and then used Nginx Proxy Manager for Proxy, I got a 502 Bad Gateway – openresty mistake. This is how I solved it.

I had an installation af Portainer and Nginx Proxy Manager, where I using Docker installed WordPress. But when I used Nginx Proxy Manager to point the subdomain wp.server.dk against the WP installation, I got this mistake:

It took my a while to figure out where the mistake was, so in this article I will share the solution with you.

First I want to show my settings in Proxy Host for the WordPress Container:

On the SSL tab I choose to create a Lets Encrypt certificate, and initially I therefore thought it was logically to choose https as Scheme. However, that made the 502 Bad Gateway – openresty mistake. The solution was therefore to change the scheme back to http – even though you have installed a Lets Encrypt certificate and will access the site with https://wp.server.dk.

So when creating a proxy for WordPress in Nginx Proxy Manager remember to:

  • Always choose http as Scheme.
  • Always use the port of the container (80) not the local port.

I hope this could help other people in the same situation.

5 1 vote
Article Rating

Andreas Andersen

Forfatter og grundlægger af IT-blogger.dk, der har blogget om IT-emner siden 2012. Findes på Mastodon på @aphandersen@ansico.dk

You may also like...

Giv besked ved

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x