Forked from Sun1ive/docker + nginx + nodejs + pm2 + mongo.txt
Created
July 23, 2019 09:59
-
-
Save CrazyAdmin/e76f373b2d017227c4a3fa3050803f06 to your computer and use it in GitHub Desktop.
docker + nginx + nodejs + pm2 + mongo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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