Replies: 2 comments
-
With NPM and the Wordpress container on the same network, try using the container name as the 'forward hostname' and the internal listening port of the container (should be 80). Within a docker network, container names resolve automatically and use the internal IPs and ports. Docker purposefully prevents containers from accessing other containers via their external ips/ports for security reasons, which sounds like what you are running into in your example. I've been setting up NPM for the last two days, and most of my proxy hosts are referencing containername:internalport. With that in place and working, you don't even need to publish the external ports for the container and access it exclusively via NPM. |
Beta Was this translation helpful? Give feedback.
-
Hi I got this working shortly after pulling all my hair out and posting the message above! In case its of assistance to others, below is how. Note that I am currently just using mappings as its on a NAS and easier to edit config if its in a file share I can see from PC. You will prob want to use docker-managed volumes instead. I am using Portainer to install, and doing so within a stack. Assumptions:
1) Install jc21/nginx-proxy-manager via the compose file below:
The networks section creates a new network called frontend which is later also used by the wordpress stack 2) Install Wordpress and its database via compose file below:
There are two networks here, the nginx-reverse-proxy_frontend is the full name of the network created by the nginx compose file, that the wordpress stack also uses. This is specified as external: true indicating that it pre-exists. The 'internal' network is so that WP can communicate with its database. The full name for this ends up as: wordpress-container-web_internal 3) Bring Up the containers (stacks) and configure wordpress
4) Configure nginx
Setting the above should cause the proxy detection in wp-config.php to work, if it does not, edit wp-config.php and force the issue yourself, search for $_SERVER['HTTPS'] = 'on'; and then bung this in explicitly outwith the 'if' (note that I did not need this in the end) 5) Troubleshooting
Hope this helps someone pull out less hair than I did. |
Beta Was this translation helpful? Give feedback.
-
As per the title - does not work for proxying a wordpress container that is running on the same docker.
Tried basically everything re suggestions for including both the proxy manager and wordpress container in the same docker network. I simply get error 502 from the proxy manager when trying to visit the URL - I assume that the proxy manager cannot 'see' the docker container.
I have tried forwarding to localhost, 127.0.0.1, 192.168.20.3 (the docker host IP), the docker network internal IP, the docker image name, everything all to no avail. My wordpress is accessible locally just fine via http://192.168.20.3:20080
I can proxy to other machines on my network just fine - eg my home assistant VM - as such, the proxy manager its self is working fine - it just wont proxy to other dockers.
Loads of chatter about error 502 when accessing a wordpress container via a proxy in the forums, unfortunately - none of them actually solved. If anyone has an idea how I might make this work, I am all ears!
Beta Was this translation helpful? Give feedback.
All reactions