Make config file:
sudo nano /etc/nginx/sites-available/bot.conf
Then copy and paste bot.conf
content and edit YOUR.DOMAIN strings. Now install Let's Encrypt on your server. For example in Debian you need to add jessie-backports
and easily install it with apt-get
:
sudo apt-get install -t jessie-backports letsencrypt
Then get cert for you domain:
sudo letsencrypt certonly --standalone --email [email protected] -d YOUR.DOMAIN --rsa-key-size 4096
Don't forget, you DNS A and AAAA record should point on server there you setup it, e. g. on your VPS.
Now get Diffie-Hellman key:
sudo openssl dhparam -dsaparam -out /etc/letsencrypt/live/YOUR.DOMAIN/dhparam.pem 4096
Make symlink on your new nginx config and restart nginx:
sudo ln -s /etc/nginx/sites-available/bot.conf /etc/nginx/sites-enable/bot.conf
sudo systemctl restart nginx
Ensure that you replace this:
const tg = new Telegram.Telegram('YOUR_TOKEN');
on this:
const tg = new Telegram.Telegram('YOUR_TOKEN', {
webhook: {
url: 'https://YOUR.DOMAIN',
port: 3000,
host: 'localhost'
}
})