How to enable SSL on VPS service

Purchase an SSL from where you trust. I purchase it from Namecheap. After purchase, it’s asking to enable.

1 Step: It asks to enter a CSR token.

To generate the CSR token, you need to log in to the VPS server. To do so, locate your targeted location where you want to store SSL info.

cd /var/www/ssl_namecheap/2026

Then follow the below commands, replacing domain names with your domain name.

openssl req -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr

Output should be like this…

Output
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:New York
Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Company
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:example.com
Email Address []:sammy@example.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Now, get the content from .CRS file and enter on Namecheap then click on next.

Then verify the domain by DNC CNAME recode which you will get on the namecheap dashboard. After successfully verifying you will get certificate details in your email.

Upload the certificate to the same folder on your VPS and run the below command to generate combined.crt file which you should point from your site config file.

cat example.com.crt intermediate.crt > example.com.chained.crt

It will generate a new file name example.com.chained.crt, now point that file from your site config file which should be available inside sites-available.

Now, check if everything are good

sudo nginx -t

Then restart

sudo systemctl restart nginx

Hope all are ok, you can check SSL here now.