I have a VM with Ubuntu and Docker.
I have two containers (ASP .NET 6 app and nginx server)
My docker compose file looks like this:
version: '3.9'
services:
nginx:
container_name: nginx
image: nginx
ports:
- "80:80"
depends_on:
- myapp
volumes:
- ./nginx/conf.d/:/etc/nginx/conf.d/
restart: always
myapp:
container_name: myapp
image: <...>
restart: always
volumes:
- logs:/mnt/logs
- data:/mnt/data
volumes:
logs:
data:
when i try to connect to port 80 it says "connection refused".
If I try it with default nginx config, then default nginx page is opened.
if I open port 5000 for myapp, then i can access it on this port.
nginx config:
server {
listen: 80;
location / {
proxy_pass http://myapp:5000;
}
}
CodePudding user response:
Problem is solved: my config file mount was incorrect.
Correct version:
<...>
volumes:
- nginx-config:/etc/nginx/conf.d
<...>
volumes:
logs:
data:
nginx-config:
and now i can change file /var/lib/docker/volumes/coi_nginx-config/_data/default.conf