【发布时间】:2018-04-05 01:40:08
【问题描述】:
上下文:
我有一个带有 apache2 的 Debian。我可以通过以下 ip 访问这个 Debian:192.168.12.28。
在这个 Debian 上,我有两个具有以下 ips 的容器:
-172.18.0.2
-172.19.0.2
有问题的:
我想从外部访问我的 container1,例如: 192.168.12.28/container1 要么 myDomain/container1
我尝试了什么:
两个域: test1.domain.fr 与以下 test1.domain.fr.conf :
<VirtualHost *:80>
ServerName test1.domain.fr
ProxyPass / http://172.18.0.2:8080/
ProxyPassReverse / http://172.18.0.2:8080/
ProxyRequests Off
</VirtualHost>
test2.domain.fr 带有以下 test2.domain.fr.conf :
<VirtualHost *:80>
ServerName test2.domain.fr
ProxyPass / http://172.19.0.2:8080/
ProxyPassReverse / http://172.19.0.2:8080/
ProxyRequests Off
</VirtualHost>
我已启用域:
a2ensite test1.domain.fr
a2ensite test2.domain.fr
我有什么:
当我想访问 192.168.12.28 时: Apache 的页面“它有效!”
当我想访问 192.168.12.28/test1.domain.fr 或 192.168.12.28/test2.domain.fr 时: 在此服务器上找不到请求的 URL /test1(or 2).domain.fr。
当我想访问 test1.domain.fr 或 test2.domain.fr 时: 找不到 test1(or 2).domain.fr
感谢您的帮助和 对不起我的英语不好! :-)
编辑:我目前正在搜索,但暂时无法使用!
编辑:我的 container1 的配置类似于:“8081:8080”和“444:443”,而我的 container2 的配置类似于:“8080:8080”和“443:443”
在这里编辑我的 docker-compose 文件:
第一个容器:
version: '2'
services:
php:
build: php
ports:
- "8080:8080"
- "443:443"
volumes:
- ./php/www:/var/www/html
第二个容器:
version: '2'
services:
php:
build: php
ports:
- "8081:8080"
- "444:443"
volumes:
- ./php/www:/var/www/html
【问题讨论】:
-
在您的 Debian 机器上是否可以使用这些站点?例如:
curl 127.0.0.1/test1.domain.fr -
不是他们不是,我和外面的反应一样
标签: apache redirect docker mod-rewrite virtualhost