backend-proxy: container_name: backend-proxy image: nginx:1.24-alpine-slim ports: - "81:80" - "5000:443" restart: always volumes: - ./backend-proxy-conf/reverse_proxy.conf:/etc/nginx/conf.d/default.conf:ro # set-up reverse proxy conf - ./backend-proxy-logs:/var/log/nginx - /etc/ssl:/etc/ssl:ro # volume on certificates backend: container_name: myWebApi image: mydockerhub/myWebApi:1.0 expose: - "5001" depends_on: - database restart: always environment: - ASPNETCORE_ENVIRONMENT=Production - ASPNETCORE_URLS=http://+5001 - DB_CONNECTION_STRING=server=database;port=3306;user id=root;password=root;database=some_db
server { listen 80; listen 443; location / { proxy_pass http://myWebApi:5001/; # I don't know if I can use container name here directly }}