Setting up SSL
Prerequisite
You need to have snapd
installed.
This step already covered in Server Preparation
And remove any previous certbot version installed by executing command below:
Setting up CertBot
CertBot Installation
We will use CertBot as our SSL manager You can install it by using below commands:
CertBot DNS Plugin
Since we're using Cloudflare as our DNS Manager, we need to install Cloudflare plugin using command below:
You will need to install another plugin if you use other DNS manager. visit Official CertBot Guide for more details
Get your credential API Token
To obtain your Cloudflare API token, follow these steps:
Log in to your Cloudflare account.
Go to the Profile section.
Select API Tokens.
Click on Create Token.
For this case, you only need "Edit zone DNS" permissions.
Once you've configured the token, click Continue to summary and then Create Token.
Make sure to copy your new API token and securely store it; you won’t be able to see it again.
Refer to the official Cloudflare documentation for detailed steps and information.
After you obtained your Cloudflare API Token, you need to put it in a file called certbot.ini
in your server with format like below:
you can use your text editor or this command below to write it into a file directly
Generate SSL
After you finished previous steps, now we need to generate the SSL. You can do it by executing below command:
It will generate a wildcard SSL. If you want a subdomain specific, you can replace the * symbol with your subdomain (e.g. crossfi-testnet-api.cryptonode.id)
The default location of the certificates are /etc/letsencrypt/live/cryptonode.id/fullchain.pem
for the public key and /etc/letsencrypt/live/cryptonode.id/privkey.pem
for the private key
Re-Configure NGINX to use SSL
In Routing using NGINX, we've already set up our domain to point to correct endpoint. But it's still using HTTP. Now, we will set it up so we can use HTTPS.
Edit your config by opening your previous config with this command
And replace the config with this
Repeat the same process for other endpoints and you will have all of your endpoints with SSL enabled
Last updated