![](/img/trans.png)
[英]Apache HTTPD/mod_proxy/Tomcat and SSL with client auth
[英]Running Portainer in a Docker Container with Apache 2.4 mod_proxy and basic auth
答:您需要使用标志--no-auth启动Portainer并使用mod_proxy_wstunnel。
使用--no-auth启动Portainer。 我使用以下Docker Compose文件:
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"
为Apache域配置基本身份验证。 启用mod_proxy_wstunnel 。 将以下内容添加到配置中:
<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>
我在Docker Swarm中使用Docker Flow Proxy安装了Portainer,所有这些都在Apache之后。
遵循这个想法,我能够成功配置apache。
<Location /portainer/api/websocket/>
RewriteEngine On
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /portainer/api/websocket/(.*) ws://192.168.1.190:480/portainer/api/websocket/$1 [P]
</Location>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.