- Install docker/docker-compose
- Clone the repo
docker-compose up -dinside the app folder
sudo apt install nginxsudo unlink /etc/nginx/sites-enabled/defaultcd /etc/nginx/sites-availableandvim reverse-proxy.confand paste the code in the first appendixln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.confservice nginx configtestto check if the Nginx config are fine
ufw allow OpenSSHufw allow 'Nginx Full'ufw enable
apt install certbot python3-certbot-nginxsudo certbot --nginx -d example.com -d www.example.comsystemctl status certbot.timerandcertbot renew --dry-runto check if the certbot's auto-renew is working- Update your
reverse-proxy.confwith the code in the second appendix
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
server {
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
listen 80;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}