{"id":7740,"date":"2020-03-02T17:16:24","date_gmt":"2020-03-02T14:16:24","guid":{"rendered":"http:\/\/unihost.com\/help\/?p=7740"},"modified":"2023-10-06T15:48:35","modified_gmt":"2023-10-06T12:48:35","slug":"how-to-secure-nginx-with-lets-encrypt-on-centos-8","status":"publish","type":"post","link":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/","title":{"rendered":"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7721 size-full\" src=\"https:\/\/unihost.com\/help\/minio.php?.\/le-logo-wide.png\" alt=\"Let's Encrypt\" width=\"1335\" height=\"393\" \/ title=\"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8 - Image 1\"><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Let\u2019s Encrypt is a non-profit certificate authority run by Internet Security Research Group (ISRG) that provides X.509 certificates for Transport Layer Security (TLS) encryption at no charge.<span id=\"more-7720\"><\/span>\u00a0<\/span><!--more--><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">The certificate is valid for 90 days, during which renewal can take place at any time. The offer is accompanied by an automated process designed to overcome manual creation, validation, signing, installation, and renewal of certificates for secure websites. It launched on April 12, 2016.<\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">In this article, we will show you how you can install Let\u2019s Encrypt Certificate for Nginx web<a href=\"https:\/\/unihost.com\/en\/dedicated\/\"> server<\/a> and configure the certificate to renew automatically on CentOS 8.<\/span><\/p>\n<h2 style=\"text-align: center;\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Installing Nginx<\/span><\/h2>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Nginx \u00a0is available in the default CentOS repositories.<\/span><\/p>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># dnf install nginx<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Enable and start the Nginx service.<\/span><\/p>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># systemctl enable nginx<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># systemctl start nginx<\/span><\/pre>\n<h2 style=\"text-align: center;\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Creating Virtual Host<\/span><\/h2>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">By default, Nginx is configured to load all configuration files that ends with .conf from the<em>\/etc\/nginx\/conf.d\/<\/em> directory.<\/span><\/p>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># nano \/etc\/nginx\/conf.d\/example.com.conf<\/span><br \/><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">server {<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     listen 80;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     server_name example.com www.example.com;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     return 301 https:\/\/$server_name$request_uri;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">}<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">server {<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     listen 443 ssl http2;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     server_name example.com www.example.com;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     root \/home\/example.com;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     index index.php index.html index.htm;<\/span><br \/><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     access_log \/var\/log\/nginx\/example.com.access.log;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">      error_log \/var\/log\/nginx\/example.com.error.log;<\/span><br \/><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">location ~ \\.(php|phar)(\/.*)?$ {<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     fastcgi_split_path_info ^(.+\\.(?:php|phar))(\/.*)$;<\/span><br \/><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     fastcgi_intercept_errors on;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     fastcgi_index index.php;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     include fastcgi_params;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     fastcgi_param PATH_INFO $fastcgi_path_info;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">     fastcgi_pass php-fpm;<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">}<\/span><\/pre>\n<h2 style=\"text-align: center;\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Install Certbot<\/span><\/h2>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Certbot is a free command-line tool that simplifies the process for obtaining and renewing Let\u2019s Encrypt SSL certificates from and auto-enabling HTTPS on your server.<\/span><\/p>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># wget https:\/\/dl.eff.org\/certbot-auto<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># mv certbot-auto \/usr\/local\/bin\/certbot-auto<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># chmod 0755 \/usr\/local\/bin\/certbot-auto<\/span><\/pre>\n<h2 style=\"text-align: center;\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Install Lets Encrypt Certificate<\/span><\/h2>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># \/usr\/local\/bin\/certbot-auto --nginx<\/span><br \/><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Creating virtual environment...<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Installing Python packages...<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Installation succeeded.<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Saving debug log to \/var\/log\/letsencrypt\/letsencrypt.log<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Plugins selected: Authenticator nginx, Installer nginx<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Enter email address (used for urgent renewal and security notices) (Enter 'c' to<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">cancel): <span style=\"color: #ff0000;\">admin@example.com<\/span><\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Please read the Terms of Service at<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">https:\/\/letsencrypt.org\/documents\/LE-SA-v1.2-November-15-2017.pdf. You must <\/span><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">agree in order to register with the ACME server at <\/span><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">https:\/\/acme-v02.api.letsencrypt.org\/directory <\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">(A)gree\/(C)ancel: <span style=\"color: #ff0000;\">a<\/span><\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Would you be willing to share your email address with the Electronic Frontier<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Foundation, a founding partner of the Let's Encrypt project and the non-profit<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">organization that develops Certbot? We'd like to send you email about our work<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">encrypting the web, EFF news, campaigns, and ways to support digital freedom.<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">(Y)es\/(N)o: <span style=\"color: #ff0000;\">y<\/span><\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Which names would you like to activate HTTPS for?<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">1: example.com<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">2: www.example.com<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Select the appropriate numbers separated by commas and\/or spaces, or leave input<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">blank to select all options shown (Enter 'c' to cancel): <\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Obtaining a new certificate<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Performing the following challenges:<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">http-01 challenge for example.com<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">http-01 challenge for www.example.com<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Waiting for verification...<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Cleaning up challenges<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Deploying Certificate to VirtualHost \/etc\/nginx\/conf.d\/example.com.conf<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Deploying Certificate to VirtualHost \/etc\/nginx\/conf.d\/example.com.conf<\/span><br \/><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">1: No redirect - Make no further changes to the webserver configuration.<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">new sites, or if you're confident your site works on HTTPS. You can undo this<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">change by editing your web server's configuration.<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Select the appropriate number [1-2] then [enter] (press 'c' to cancel): <span style=\"color: #ff0000;\">1<\/span><\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Future versions of Certbot will automatically configure the webserver so that all requests redirect to secure HTTPS access. You can control this behavior and disable this warning with the --redirect and --no-redirect flags.<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Congratulations! You have successfully enabled https:\/\/example.com and<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">https:\/\/www.example.com<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">You should test your configuration at:<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">https:\/\/www.ssllabs.com\/ssltest\/analyze.html?d=example.com<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">https:\/\/www.ssllabs.com\/ssltest\/analyze.html?d=www.example.com<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">IMPORTANT NOTES:<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> - Congratulations! Your certificate and chain have been saved at:<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0\/etc\/letsencrypt\/live\/example.com\/fullchain.pem<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0Your key file has been saved at:<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0\/etc\/letsencrypt\/live\/example.com\/privkey.pem<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0Your cert will expire on 2020-05-27. To obtain a new or tweaked<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0version of this certificate in the future, simply run certbot-auto<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0again with the \"certonly\" option. To non-interactively renew *all*<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0of your certificates, run \"certbot-auto renew\"<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> - Your account credentials have been saved in your Certbot<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0configuration directory at \/etc\/letsencrypt. You should make a<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0secure backup of this folder now. This configuration directory will<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0also contain certificates and private keys obtained by Certbot so<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0making regular backups of this folder is ideal.<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> - If you like Certbot, please consider supporting our work by:<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0Donating to ISRG \/ Let's Encrypt: \u00a0 https:\/\/letsencrypt.org\/donate<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0Donating to EFF:\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 https:\/\/eff.org\/donate-le<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> - We were unable to subscribe you the EFF mailing list because your<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0e-mail address appears to be invalid. You can try again later by<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"> \u00a0\u00a0visiting https:\/\/act.eff.org.<\/span><\/pre>\n<h2 style=\"text-align: center;\"><span id=\"Test_Lets_Encrypt_SSL_Certificate\" style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Test Let\u2019s Encrypt SSL Certificate<\/span><\/h2>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Test your SSL certificate for problems and its security ratings by going to the below URL.\u00a0<\/span><br \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/www.ssllabs.com\/ssltest\" rel=\"nofollow nofollow noopener noreferrer\" target=\"_blank\">https:\/\/www.ssllabs.com\/ssltest<\/a><\/span><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/unihost.com\/help\/minio.php?DM_260220_jK0ZCk3R.png\" alt=\"Test Let\u2019s Encrypt SSL Certificate\" width=\"995\" height=\"473\" \/ title=\"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8 - Image 2\"><\/span><\/p>\n<p><a href=\"https:\/\/www.sslshopper.com\/ssl-checker.html\" rel=\"nofollow nofollow noopener noreferrer\" target=\"_blank\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">https:\/\/www.sslshopper.com\/ssl-checker.html<\/span><\/a><\/p>\n<h2 style=\"text-align: center;\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/unihost.com\/help\/minio.php?DM_260220_6okiS2Td.png\" alt=\"Renew Let\u2019s Encrypt Certificate\" width=\"733\" height=\"193\" \/ title=\"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8 - Image 3\"><\/span><span id=\"Renew_Lets_Encrypt_Certificate\" style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Renew Let\u2019s Encrypt Certificate<\/span><\/h2>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Let\u2019s Encrypt certificate is valid for 90 days from the date of issuance, and it needs to be renewed before it expires.<\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Run the following command to create a new cronjob which will renew the certificate and restart Nginx.<\/span><\/p>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># echo \"0 0,12 * * * root python3 -c 'import random; import time; time.sleep(random.random() * 3600)' &amp;&amp; \/usr\/local\/bin\/certbot-auto -q renew --renew-hook \\\"systemctl reload nginx\\\"\" | sudo tee -a \/etc\/crontab &gt; \/dev\/null<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">You can also simulate the certificate renewal process with the below command to ensure the renewal goes smooth.<\/span><\/p>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"># \/usr\/local\/bin\/certbot-auto renew --dry-run<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">In this guide, we demonstrated how you can use certbot to install and configure the Let\u2019s Encrypt certificate on Nginx webserver running on a CentOS 8 system.<\/span><\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s Encrypt is a non-profit certificate authority run by Internet Security Research Group (ISRG) that provides X.509 certificates for Transport Layer Security (TLS) encryption at no charge.\u00a0<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[158],"tags":[58,548,95],"class_list":["post-7740","post","type-post","status-publish","format-standard","hentry","category-dedicated-servers","tag-centos","tag-lets-encrypt","tag-nginx"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to secure Nginx with Let&#039;s Encrypt on CentOS 8 - Unihost.FAQ<\/title>\n<meta name=\"description\" content=\"\u2714 Installing Nginx \u2714 Creating Virtual Host \u2714 Install Certbot \u2714 Install Lets Encrypt Certificate \u2714 Test Let\u2019s Encrypt SSL Certificate\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to secure Nginx with Let&#039;s Encrypt on CentOS 8 - Unihost.FAQ\" \/>\n<meta property=\"og:description\" content=\"\u2714 Installing Nginx \u2714 Creating Virtual Host \u2714 Install Certbot \u2714 Install Lets Encrypt Certificate \u2714 Test Let\u2019s Encrypt SSL Certificate\" \/>\n<meta property=\"og:url\" content=\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/\" \/>\n<meta property=\"og:site_name\" content=\"Unihost.FAQ\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/unihost\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-02T14:16:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-06T12:48:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/unihost.com\/help\/wp-content\/uploads\/le-logo-wide.png\" \/>\n<meta name=\"author\" content=\"Unihost Support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@unihost\" \/>\n<meta name=\"twitter:site\" content=\"@unihost\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Unihost Support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/\"},\"author\":{\"name\":\"Unihost Support\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a\"},\"headline\":\"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8\",\"datePublished\":\"2020-03-02T14:16:24+00:00\",\"dateModified\":\"2023-10-06T12:48:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/\"},\"wordCount\":302,\"publisher\":{\"@id\":\"https:\/\/unihost.com\/help\/#organization\"},\"image\":{\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/unihost.com\/help\/wp-content\/uploads\/le-logo-wide.png\",\"keywords\":[\"CentOS\",\"let's encrypt\",\"Nginx\"],\"articleSection\":[\"02. Dedicated servers\"],\"inLanguage\":\"en\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/\",\"url\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/\",\"name\":\"How to secure Nginx with Let's Encrypt on CentOS 8 - Unihost.FAQ\",\"isPartOf\":{\"@id\":\"https:\/\/unihost.com\/help\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/unihost.com\/help\/wp-content\/uploads\/le-logo-wide.png\",\"datePublished\":\"2020-03-02T14:16:24+00:00\",\"dateModified\":\"2023-10-06T12:48:35+00:00\",\"description\":\"\u2714 Installing Nginx \u2714 Creating Virtual Host \u2714 Install Certbot \u2714 Install Lets Encrypt Certificate \u2714 Test Let\u2019s Encrypt SSL Certificate\",\"breadcrumb\":{\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage\",\"url\":\"https:\/\/unihost.com\/help\/minio.php?.\/le-logo-wide.png\",\"contentUrl\":\"https:\/\/unihost.com\/help\/minio.php?.\/le-logo-wide.png\",\"width\":1335,\"height\":393},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Unihost\",\"item\":\"https:\/\/unihost.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Help\",\"item\":\"https:\/\/unihost.com\/help\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/unihost.com\/help\/#website\",\"url\":\"https:\/\/unihost.com\/help\/\",\"name\":\"Unihost.FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/unihost.com\/help\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/unihost.com\/help\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/unihost.com\/help\/#organization\",\"name\":\"Unihost\",\"alternateName\":\"Unihost\",\"url\":\"https:\/\/unihost.com\/help\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png\",\"contentUrl\":\"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png\",\"width\":300,\"height\":300,\"caption\":\"Unihost\"},\"image\":{\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/unihost\/\",\"https:\/\/x.com\/unihost\",\"https:\/\/www.instagram.com\/unihost\/?hl=en\",\"https:\/\/www.linkedin.com\/company\/unihost-com\",\"https:\/\/www.youtube.com\/channel\/UCITKsxMDnslQY8brN3advgw\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a\",\"name\":\"Unihost Support\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g\",\"caption\":\"Unihost Support\"},\"sameAs\":[\"https:\/\/unihost.com\/\"],\"url\":\"https:\/\/unihost.com\/help\/author\/support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to secure Nginx with Let's Encrypt on CentOS 8 - Unihost.FAQ","description":"\u2714 Installing Nginx \u2714 Creating Virtual Host \u2714 Install Certbot \u2714 Install Lets Encrypt Certificate \u2714 Test Let\u2019s Encrypt SSL Certificate","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/","og_locale":"en_US","og_type":"article","og_title":"How to secure Nginx with Let's Encrypt on CentOS 8 - Unihost.FAQ","og_description":"\u2714 Installing Nginx \u2714 Creating Virtual Host \u2714 Install Certbot \u2714 Install Lets Encrypt Certificate \u2714 Test Let\u2019s Encrypt SSL Certificate","og_url":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/","og_site_name":"Unihost.FAQ","article_publisher":"https:\/\/www.facebook.com\/unihost\/","article_published_time":"2020-03-02T14:16:24+00:00","article_modified_time":"2023-10-06T12:48:35+00:00","og_image":[{"url":"https:\/\/unihost.com\/help\/wp-content\/uploads\/le-logo-wide.png","type":"","width":"","height":""}],"author":"Unihost Support","twitter_card":"summary_large_image","twitter_creator":"@unihost","twitter_site":"@unihost","twitter_misc":{"Written by":"Unihost Support","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#article","isPartOf":{"@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/"},"author":{"name":"Unihost Support","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a"},"headline":"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8","datePublished":"2020-03-02T14:16:24+00:00","dateModified":"2023-10-06T12:48:35+00:00","mainEntityOfPage":{"@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/"},"wordCount":302,"publisher":{"@id":"https:\/\/unihost.com\/help\/#organization"},"image":{"@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage"},"thumbnailUrl":"https:\/\/unihost.com\/help\/wp-content\/uploads\/le-logo-wide.png","keywords":["CentOS","let's encrypt","Nginx"],"articleSection":["02. Dedicated servers"],"inLanguage":"en"},{"@type":"WebPage","@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/","url":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/","name":"How to secure Nginx with Let's Encrypt on CentOS 8 - Unihost.FAQ","isPartOf":{"@id":"https:\/\/unihost.com\/help\/#website"},"primaryImageOfPage":{"@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage"},"image":{"@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage"},"thumbnailUrl":"https:\/\/unihost.com\/help\/wp-content\/uploads\/le-logo-wide.png","datePublished":"2020-03-02T14:16:24+00:00","dateModified":"2023-10-06T12:48:35+00:00","description":"\u2714 Installing Nginx \u2714 Creating Virtual Host \u2714 Install Certbot \u2714 Install Lets Encrypt Certificate \u2714 Test Let\u2019s Encrypt SSL Certificate","breadcrumb":{"@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#primaryimage","url":"https:\/\/unihost.com\/help\/minio.php?.\/le-logo-wide.png","contentUrl":"https:\/\/unihost.com\/help\/minio.php?.\/le-logo-wide.png","width":1335,"height":393},{"@type":"BreadcrumbList","@id":"https:\/\/unihost.com\/help\/how-to-secure-nginx-with-lets-encrypt-on-centos-8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Unihost","item":"https:\/\/unihost.com\/"},{"@type":"ListItem","position":2,"name":"Help","item":"https:\/\/unihost.com\/help\/"},{"@type":"ListItem","position":3,"name":"How to secure Nginx with Let&#8217;s Encrypt on CentOS 8"}]},{"@type":"WebSite","@id":"https:\/\/unihost.com\/help\/#website","url":"https:\/\/unihost.com\/help\/","name":"Unihost.FAQ","description":"","publisher":{"@id":"https:\/\/unihost.com\/help\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/unihost.com\/help\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/unihost.com\/help\/#organization","name":"Unihost","alternateName":"Unihost","url":"https:\/\/unihost.com\/help\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/","url":"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png","contentUrl":"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png","width":300,"height":300,"caption":"Unihost"},"image":{"@id":"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/unihost\/","https:\/\/x.com\/unihost","https:\/\/www.instagram.com\/unihost\/?hl=en","https:\/\/www.linkedin.com\/company\/unihost-com","https:\/\/www.youtube.com\/channel\/UCITKsxMDnslQY8brN3advgw"]},{"@type":"Person","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a","name":"Unihost Support","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g","caption":"Unihost Support"},"sameAs":["https:\/\/unihost.com\/"],"url":"https:\/\/unihost.com\/help\/author\/support\/"}]}},"_links":{"self":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/7740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/comments?post=7740"}],"version-history":[{"count":15,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/7740\/revisions"}],"predecessor-version":[{"id":16334,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/7740\/revisions\/16334"}],"wp:attachment":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/media?parent=7740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/categories?post=7740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/tags?post=7740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}