Q: How do I configure Apache 2.4 as a reverse proxy for Portainer using Basic Authentication?
Portainer is a UI for managing Docker container. The Portainer documentation has a sample nginx configuration, but unfortunately none for apache.
A: You need to start Portainer with the flag --no-auth and use mod_proxy_wstunnel.
Start Portainer with --no-auth. I use the following Docker Compose File:
portainer:
image: portainer/portainer
container_name: "portainer-app"
privileged: true
command: --no-auth
ports:
- 9000:9000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /srv/docker/portainer/data:/data
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
TZ: "Europe/Berlin"
Configure Basic Authentication for your Apache domain. Enable mod_proxy_wstunnel. Add the following to the configuration:
<Location /portainer/>
ProxyPass http://localhost:9000/
ProxyPassReverse http://localhost:9000/
RequestHeader set Connection ""
</Location>
<Location /portainer/api/websocket/>
RequestHeader set Upgrade $http_upgrade;
RequestHeader set Connection "upgrade"
ProxyPass ws://localhost:9000/api/websocket/
</Location>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With