Skip to content

Nginx

Create folders:

Bash
mkdir -p nginx/{nginx-conf,ssl} && cd nginx
nano docker-compose.yml

docker-compose.yml

YAML
version: '3.7'

services:
  prod:
    image: nginx:stable-alpine
    volumes:
      - ./nginx-conf:/etc/nginx/conf.d # place for nginx *.conf files
      - ./ssl:/etc/nginx/ssl # place for ssl certs
      - /webapps:/webapps  # this is where I like to keep my webapps
    networks:
      - durbok-net
    deploy:
      placement:
        constraints:
          - node.role == manager
      replicas: 1
      restart_policy:
        condition: on-failure
    ports:
      - 80:80
      - 443:443

networks:
  durbok-net:
    external: true

volumes:
  nginx-conf:

Keep your nginx *.conf files in nginx-conf folder.