The commands are as per instruction given on the page
service nginx stop
Edit the wordpress_http.conf and wordpress_https.conf Nginx configuration files. Find server_name _ and replace the _ with your domain name.
nano /etc/nginx/conf.d/wordpress_http.conf
Replace the underscore “_” after server_name to your domain name.
server_name example.com www.example.com
nano /etc/nginx/conf.d/wordpress_https.conf
Replace the underscore “_” after server_name to your domain name.
server_name example.com www.example.com`
Step Two: Download Certbot
Since Certbot does not come installed with CentOS 6, you need to obtain a copy of the Certbot package.
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
The certbot-auto package will be downloaded.
Step Three: Obtain and install SSL certificate
Certbot automates the process of obtaining certificates by providing an interactive installer.
./certbot-auto certonly --standalone
The Certbot installer will ask whether to proceed with the download. Enter “Y” to continue. Enter your email when prompted. This will be used to send you notices regarding renewal and security. Enter “A” to agree to the terms of service. Select whether you want to share your email with the Electronic Frontier Foundation. This is optional. Enter the domain names for which you want an SSL certificate separated by a space…
example.com www.example.com
Certbot will obtain your certificate and save the certificate and chain at /etc/letsencrypt/live/example.com. You will need to install these certificates by adding them to them to the Nginx site configuration files. Certbot automates this process.
./certbot-auto --nginx --redirect
Press “Enter” when asked for which names you would like to activate HTTPS. When prompted whether you would like to reinstall an existing certificate or renew, enter “1”. Certbot will update your Nginx site configuration files with the obtained SSL certificate.
Step Four: Update Nginx configuration to force SSL
In order to force the usage of HTTPS, you will need to edit the wordpress_http.conf configuration file.
nano /etc/nginx/conf.d/wordpress_http.conf
Add the following lines to the server block.
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
service nginx start
./certbot-auto renew