【发布时间】:2018-06-21 04:25:30
【问题描述】:
我最近一直在玩 docker 和 apache,这两个我都不太了解。
我有一个关于同一主机上的 2 个 docker 容器之间的通信的问题。
一个容器正在运行带有选项 -p 80:80 的 apache。 转到 localhost:80 显示默认的 apache 页面
我有第二个容器运行带有选项 -p 8787:8787 的摇杆/rstudio 映像。 转到 localhost:8787 会按预期显示 rstudio 登录页面。
我想在我的 apache 容器中进行设置,以便 localhost/rstudio 将我带到在摇杆容器中运行的 rstudio 的登录页面。
据我了解,apache 容器应该能够看到 localhost:8787,在可用站点下我有以下 rstudio.conf 文件
<VirtualHost *:80>
<Proxy *>
Allow from localhost
</Proxy>
# Specify path for Logs
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
# Following lines should open rstudio directly from the url
# Map rstudio to rstudio/
RedirectMatch ^/rstudio$ /rstudio/
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /rstudio/(.*) ws://localhost:8787/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /rstudio/(.*) http://localhost:8787/$1 [P,L]
ProxyPass /rstudio/ http://localhost:8787/
ProxyPassReverse /rstudio/ http://localhost:8787/
ProxyRequests off
</VirtualHost>
按照 rstudio 服务器配置文档的建议。但是 localhost:80/rstudio 返回 404,我不明白为什么。有人对如何解决这个问题有任何建议吗?
我想从 apache 容器内部执行此操作而不是仅在 Rocker 容器中安装 apache 的主要原因是 apache 容器也可以管理其他连接的容器。
【问题讨论】:
标签: apache docker rstudio-server