Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CrazyAdmin/e76f373b2d017227c4a3fa3050803f06 to your computer and use it in GitHub Desktop.
Save CrazyAdmin/e76f373b2d017227c4a3fa3050803f06 to your computer and use it in GitHub Desktop.
docker + nginx + nodejs + pm2 + mongo
# NGINX CONFIG
server {
listen 80 default_server;
listen [::]:80 default_server;
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment