Configure your domain DNS to point to your droplet's IP
Run Certbot to create the SSL certificate
sudocertbot--nginxcertonly
Setup Nginx with SSL
Install Nginx
sudoapt-getinstallnginx
Configure the server to use SSL
# Open the following filesudovim/etc/nginx/sites-enabled/default#paste the following below and set to your websiteserver{server_nameexample.com;listen443ssl;listen [::]:443 ssl;ssl_certificate/etc/letsencrypt/live/example.com/fullchain.pem ;ssl_certificate_key/etc/letsencrypt/live/example.com/privkey.pem ;includesnippets/ssl-params.conf;location/{proxy_buffers324m;proxy_busy_buffers_size25m;proxy_buffer_size512k;proxy_ignore_headers"Cache-Control""Expires";proxy_max_temp_file_size0;proxy_set_headerHost $host;proxy_set_headerX-Real-IP $remote_addr;proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;client_max_body_size1024m;client_body_buffer_size4m;proxy_intercept_errorsoff;proxy_passhttp://localhost:36657;proxy_http_version1.1;proxy_set_headerUpgrade $http_upgrade;##bypass timeoutproxy_connect_timeout300;proxy_send_timeout300;proxy_read_timeout300;send_timeout300;proxy_set_headerConnection""; }}
Test your conf
sudonginx-t> nginx: the configuration file /etc/nginx/nginx.conf syntax is ok> nginx: configuration file /etc/nginx/nginx.conf test is successful