# NGINX CONFIG server { listen 80 default_server; listen [::]:80 default_server; return 301 https://$host$request_uri; } server { listen 443 ssl default_server; listen [::]:443 ssl default_server; ssl on; ssl_certificate ssl/example.com.crt; ssl_certificate_key ssl/example.com.key; server_name example.com; root /var/www/example.com; index index.html; location / { proxy_pass http://api:3000; } } # Docker-compose.yml version: '3.2' services: web: image: nginx restart: on-failure volumes: - ./config:/etc/nginx/conf.d - ./ssl:/etc/nginx/ssl ports: - "80:80" api: image: node:latest volumes: - ./myapp:/usr/app command: /bin/bash -c "cd /usr/app && npm i && npm start" #ssl #ssl for localhost https://letsencrypt.org/docs/certificates-for-localhost/ #ssl for domain https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04