- Install docker/docker-compose
- Clone the repo
docker-compose up -d
inside the app folder
sudo apt install nginx
sudo unlink /etc/nginx/sites-enabled/default
cd /etc/nginx/sites-available
andvim reverse-proxy.conf
and paste the code in the first appendixln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.conf
service nginx configtest
to check if the Nginx config are fine
ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable
apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
systemctl status certbot.timer
andcertbot renew --dry-run
to check if the certbot's auto-renew is working- Update your
reverse-proxy.conf
with 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
}