Skip to main content

Configuration

Configuration SSL Letsencrypt

Setting Up SSL Certificate with Nginx with Certbot and Letsencrypt.

Install nginx:

sudo apt install nginx

Remove nginx default site:

sudo rm /etc/nginx/sites-enabled/default

Create a new nginx site to wppconnect-server:

sudo nano /etc/nginx/sites-available/wppconnect-server

Edit and fill it with this information, changing server_name to yours equivalent to myapp.mydomain.com:

server {
server_name myapp.mydomain.com;

location / {
proxy_pass http://127.0.0.1:21465;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}

Create a symbolic links to enable nginx sites:

sudo ln -s /etc/nginx/sites-available/wppconnect-server /etc/nginx/sites-enabled

By default, nginx limit body size to 1MB, which isn't enough for some media uploads. Lets change it to 20MB, adding a new line to config file:

sudo nano /etc/nginx/nginx.conf
...
http {
...
client_max_body_size 20M; # HANDLE BIGGER UPLOADS
}

Test nginx configuration and restart server:

sudo nginx -t
sudo service nginx restart

Now, enable SSL (https) on your sites to use all app features like notifications and sending audio messages. An easy way to this is using Certbot:

Install certbot:

sudo snap install --classic certbot
sudo apt update

Enable SSL on nginx (Fill / Accept all information required):

sudo certbot --nginx