Install SSL certificate through letsencrypt on nginx

The days of expensive SSL Certificates are over. Letsencrypt is rapidly changing the way certificates are handled. The basic functionality is that you install the letsencrypt client on your server and from there it does its magic to authenticate your server. They also offer a lot of automation tools, which might scare you at first. But it’s really easy to get certificates and install them e.g. with nginx. Here’s how, assuming you have nginx installed on an ubuntu server.

1) Go to your registrar and point your site, e.g. to your servers IP e.g.

2) Login to your server (ssh root@ on digital ocean for example), then:

git clone
cd letsencrypt
./letsencrypt-auto certonly --standalone --email -d -d
cd /etc/nginx/ssl/
ln -s /etc/letsencrypt/live/
ln -s /etc/letsencrypt/live/

3) Use the following inside your http block of the nginx.conf file:

  upstream project {
    server localhost:8080;

  server {
    listen  80;
    return  301 https://$host$request_uri;

  server {
    listen 443 ssl;
    ssl_certificate /etc/nginx/ssl/;
    ssl_certificate_key /etc/nginx/ssl/;
    ssl_protocols TLSv1.2 TLSv1.1 TLSv1;

    location / {
      proxy_pass http://project;
      proxy_read_timeout 1000;

4) service nginx reload and enjoy.


One Reply to “Install SSL certificate through letsencrypt on nginx”

Leave a Reply

Your email address will not be published.