NVM
Evolution API can be easily installed using the Node Version Manager (NVM). Follow these steps to set up your environment and start the Evolution API on your server.
Install NVM
First, download and install Node.js. You can do this by running the following commands:
Now, just point to the NVM directories and install Node:
Confirm that NVM was successfully installed:
If you haven’t configured it yet, you can also set up your private server’s timezone with the following command:
Clone the official GitHub repository to your private server.
Next, navigate to the folder where the project is located.
Now, let’s copy the env.yml
file with the settings you need to edit.
This command creates a copy of the default environment file.
Next, open the env.yml file in a text editor to enter your configuration settings. You can use nano, a command-line text editor, for this purpose:
In the nano editor, navigate through the file and replace the default values with your specific settings. This can include database connection strings, API keys, server ports, etc.
Refer to the environment variables section for detailed instructions on how to set up your env.yml
file.
To start the Evolution API, use the following command:
Install and Configure PM2
Use PM2 to install PM2 and start the manager for the API process:
Optional: You may need to allocate more memory for PM2, especially if your server has the capacity:
In the example above, it is assumed that your VPS has at least 4GB of RAM available exclusively for the Evolution API.
Available memory may vary, we recommend at least 1GB to run Evolution.
If you want to ensure the API is running, simply use your browser to access http://localhost:8080. This should be the response from your browser:
Make your life easier with the JSON Formatter extension in Google Chrome or Microsoft Edge.
EvolutionAPI has built-in Swagger endpoint documentation, which you can use to see all possible endpoints and test requests by accessing http://localhost:8080/docs
.
Nginx Configuration
First, let’s install, start, enable, and test the Nginx service on your private server.
If the information “Active: active (running)” appears in green, it means that Nginx is running and you can proceed to the next step.
Remove Default Nginx Configuration
First, remove the default site file that comes enabled with Nginx:
Create a new server block file in the directory
Next, paste the Nginx configuration into the default.conf
file:
After making changes to the Nginx settings, it is essential to reload the Nginx service. This ensures that any modifications you have made are applied and become effective.
Run the following command in the terminal to reload Nginx:
Make the nginx user the owner of the web directory, by default, it is owned by the root user:
Now, create a Virtual Host pointing to your subdomain by editing the api
file:
Next, paste the Nginx configuration into the api
file:
Create a symbolic link between the api
and sites-enabled
files:
Next, validate the Nginx configuration for the subdomain:
This message should appear on your terminal if everything has been set up correctly: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Reload Nginx for the changes to take effect.
Install Certbot for SSL Certificate
To secure your Evolution API with an SSL certificate, you can use Certbot. Install Certbot using the following command:
Certify the API subdomain
You will be asked if you want to enter an email to receive notifications when the generated certificate is close to its expiration date.
If the certification is successful, at the end of the process, a line with the following message will be displayed:
“Congratulations! You have successfully enabled HTTPS”