【发布时间】:2021-03-05 13:56:14
【问题描述】:
I've been struggling to make changes to my docker app。经过大量试验和错误后,我认为我的 nginx 配置文件实际上可能不是我的 nginx 配置文件。
我已经确定了这一点,因为我尝试将其完全删除,并且我的应用与 docker 运行相同。
看起来我通过 app.conf 文件对我的 nginx 服务所做的更改对我的应用程序的其余部分没有影响。
我试图了解我的卷映射是否正确。这是我的码头工人撰写:
version: "3.5"
services:
collabora:
image: collabora/code
container_name: collabora
restart: always
cap_add:
- MKNOD
environment:
- "extra_params=--o:ssl.enable=false --o:ssl.termination=true"
- domain=mydomain\.com
- dictionaries=en_US
ports:
- "9980:9980"
volumes:
- ./appdata/collabora:/config
nginx:
image: nginx:1.15-alpine
restart: unless-stopped
depends_on:
- certbot
- collabora
volumes:
# - ./data/nginx:/etc/nginx/conf.d
- ./data/nginx:/etc/nginx
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
ports:
- "80:80"
- "443:443"
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
restart: unless-stopped
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
我的项目目录是:
/我的项目
- docker-compose.yaml
- 数据
- nginx
- app.conf
- nginx
然后我的 app.conf 有各种 nginx 设置
server {
listen 80;
server_name example.com www.example.com;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
} ... more settings below
假设我的 app.conf 文件没有被使用是正确的,我怎样才能正确地将本地的 app.conf 映射到 nginx 容器中的正确位置?
【问题讨论】:
标签: docker nginx docker-compose