docker - 每次请求都拒绝 DigitalOcean 液滴连接
问题描述
我设法将我的项目放入 droplet 并成功运行 docker-compose build。当我运行 docker-compose up 并尝试在我的域上使用 swagger 时,我在控制台中收到以下错误消息。
https-portal1_1 | 2020/03/03 22:52:13 [error] 291#291: *51 connect() failed (111: Connection refused) while connecting to upstream.
我必须补充一点,没有安装 Nginx,因为我是新手,需要一些帮助。
码头工人-compose.yml:
#docker-compose
version: '2'
services:
app:
build:
context: ./
dockerfile: Dockerfile
https-portal:
image: steveltn/https-portal:1
ports:
- '80:80'
- '443:443'
links:
- app
restart: always
environment:
DOMAINS: 'ns2.wechoose.ro -> http://app:5000'
STAGE: 'production'
Nginx 尚未安装,我尝试安装它,但它失败可能是因为我没有正确配置。
我之前使用的 Nginx 配置文件,失败是这样的:
Nginx:
server {
server_name ns2.wechoose.ro www.ns2.wechoose.ro;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
解决方案
推荐阅读
- pandas - 如何确保pandas的lower方法中数值不被NaN替换?
- apache-kafka - Kafka 至少一个高可用性概念
- ansible - Ansible Playbook 是否有必要指定要通过 dist-upgrade 暂停的软件包的确切版本?
- angular - 为什么导航时角度返回false
- reactjs - 输入一个同时使用 withRouter 和 connect 的 HOC 组件
- java - 扩展类时初始化程序块的行为如何?
- python - pytorch中F.normalize的grad很奇怪
- c# - 如何在 C# 中读取 numrange 字段?
- api - 在微服务中配置下游 API 端点
- php - 使用 composer 安装 laravel 包而不更新依赖项