下面是我的docker-compose.yml
:
version: '3'
services:
proxy:
image: nginx:1.11 # this will use the latest version of 1.11.x
ports:
- '80:80' #expose 80 on host and send it to container on 80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
web:
image: httpd #this will use httpd latest
我在AWS EC2实例中执行了以上代码,并按预期创建了两个服务代理和Web。
我已经在ec2实例上安装了docker和docker compose并且
此实例的入站/出站规则是“所有流量”,这意味着该实例上的端口80
已打开。
但是,当我尝试使用以下方法通过浏览器访问apache(httpd)时
网址htpp://Public Ip of EC2 Instance:80
,则它不会打开apache的默认页面,而是显示消息:
无法访问此站点54.211.70.155拒绝连接。尝试:检查连接检查代理和防火墙ERR_CONNECTION_REFUSED“