【发布时间】:2022-01-16 10:20:36
【问题描述】:
Nginx 的无数教程和配置不一定适合我的用例,我有点不知所措,所以我仍然感到困惑。我不一定需要答案,但需要指出如何使用我的设置设置 SSL 的正确方向。
我的 docker-compose、frontend(react)、api (python/flask)、postgres 和 nginx 中有 4 个服务。
这是我的 nginx 配置
upstream frontend {
server frontend:3333;
}
upstream api {
server api:8000;
}
server {
listen 80;
location / {
proxy_pass http://frontend;
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://api;
}
}
我在 docker-compose 中的 nginx 服务
nginx:
depends_on:
- api
- frontend
restart: unless-stopped
build: ./nginx
volumes:
- ./
ports:
- "80:80"
- "443:443"
还有一个 Dockerfile
FROM nginx
COPY ./default.conf /etc/nginx/conf.d/default.conf
我只需要指出使用此配置启动和运行 SSL 所需步骤的正确方向
【问题讨论】:
标签: docker nginx ssl https docker-compose