Account Balance:    

How to install Let's Encrypt SSL Certificates on nginx?

 

NameOcean provides free wildcard Let's Encrypt certificates on it's dashboard automatically. You don't have to worry learning command-line certbot tool. Take a look at our guide to generate SSL Certificates on NameOcean by only few clicks: https://nameocean.net/article/how-create-free-ssl-nameocean/

Now we will install SSL certificates on Nginx.

Step 1

Download your certificate on NameOcean dashboard.


Step 2

Open zip file and you will see these files.


Step 3

Copy files to your server using your preferred method like ftp or sftp. I will copy them with scp:

scp -r ~/Downloads/example.com 45.76.91.165:/root/

This will copy example.com folder to my remote server on path /root/

Also, you can download your certificate to the server from NameOcean and open zip file on server. You should right click the Download Certificate button and copy its url. It is a url something like:

https://minio.yuix.org/nameocean/ua4d3b6338c0a90a64828df4e65ff551c/example.com.zip

You can use this code to download and unzip the archive file:

wget https://minio.yuix.org/nameocean/ua4d3b6338c0a90a64828df4e65ff551c/example.com.zip
unzip example.com.zip

Now we have the certificate files on our server.


Step 4

Configure nginx

server {
listen 80;
server_name example.com www.example.com;

location / {
access_log off;
log_not_found off;
return 301 https://$host$request_uri;
}
}

server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /root/example.com/fullchain.pem;
ssl_certificate_key /root/example.com/privkey.pem;

root /path/to/mywebsite/
}

First server block redirects http://example.com/ requests to https://example.com/

Second block is your actual server block to serve your website. You can add your specific configuration to server php or python server. You can ask us below for more information.

Now we should reload or restart nginx to enable new configuration.

service nginx reload