{"id":1721,"date":"2025-07-07T14:39:12","date_gmt":"2025-07-07T13:39:12","guid":{"rendered":"https:\/\/editjournal.redakt.eu\/faxmodem\/?p=1721"},"modified":"2025-07-08T13:01:42","modified_gmt":"2025-07-08T12:01:42","slug":"nginx-ssl-error-permissions","status":"publish","type":"post","link":"https:\/\/editjournal.redakt.eu\/faxmodem\/blog\/seo-webmaster\/nginx-ssl-error-permissions\/","title":{"rendered":"If Nginx cannot read your SSL certificate file"},"content":{"rendered":"<p>I got my Letsencrypt SSL certificate and wanted to configure Nginx to use it.<\/p>\n<p>I added <code>listen 443 ssl<\/code> and pointed <code>ssl_certificate<\/code> and <code>ssl_certificate_key<\/code> to the right files, using <code>$server_name<\/code> variable. <\/p>\n<pre><code>listen 443 ssl;\nssl_certificate \/usr\/local\/etc\/letsencrypt\/live\/$server_name\/fullchain.pem;\nssl_certificate_key \/usr\/local\/etc\/letsencrypt\/live\/$server_name\/privkey.pem;<\/code><\/pre>\n<p>The above didn't work, giving me these cryptic errors:<\/p>\n<ul>\n<li><code>SSL_ERROR_INTERNAL_ERROR_ALERT<\/code> in Firefox<\/li>\n<li><code>ERR_SSL_PROTOCOL_ERROR<\/code> in Chrome<\/li>\n<\/ul>\n<p>Here's what to watch out for<\/p>\n<ol>\n<li>\n<p>Make sure you got the path right. To debug, you can use <code>add_header<\/code> on a working port 80 <code>server {}<\/code>.<\/p>\n<pre><code>add_header X-Debug-Fullchain \"\/usr\/local\/etc\/letsencrypt\/live\/$server_name\/fullchain.pem\";<\/code><\/pre>\n<\/li>\n<li>\n<p>Check <code>\/var\/log\/nginx\/error.log<\/code>, it will most likely tell you what the problem is.<\/p>\n<\/li>\n<li>\n<p>If your problem is the permissions:<\/p>\n<blockquote>\n<p>[error] 57165#100839: *2 cannot load certificate &quot;\/usr\/local\/etc\/letsencrypt\/live\/example.com\/fullchain.pem&quot;: BIO_new_file() failed (SSL: error:8000000D:system library::Permission denied:calling fopen(\/usr\/local\/etc\/letsencrypt\/live\/example.com\/fullchain.pem, r) error:10080002:BIO routines::system lib) while SSL handshaking<\/p>\n<\/blockquote>\n<p>...make sure that nginx user (most often <code>www<\/code> on FreeBSD, <code>www-data<\/code> on Linux) can access not only the actual certificate files, but also the certificate folder (<code>\/usr\/local\/etc\/letsencrypt<\/code> on FreeBSD, <code>\/etc\/letsencrypt<\/code> on Linux)<br \/>\n<strong>Bonus points<\/strong>: having the directory permissions right is especially important if using <code>$server_name<\/code> variable in the certificate path. This has to do with how nginx does <a href=\"https:\/\/nginx.org\/en\/docs\/http\/server_names.html#virtual_server_selection\">virtual server selection<\/a> in advance during SSL handshake.<\/p>\n<\/li>\n<\/ol>\n<p>Finally, remember that the actual, final certificate files are located in <code>etc\/letsencrypt\/archive<\/code>, and what you see elsewhere is most likely symliks to the archive files. To check, do <code>readlink -f \/usr\/local\/etc\/letsencrypt\/live\/example.com\/fullchain.pem<\/code>.<\/p>\n<p>Sources and further reading:<\/p>\n<ul>\n<li><a href=\"https:\/\/serverfault.com\/questions\/505015\/nginx-use-server-name-on-ssl-certificate-path\">https:\/\/serverfault.com\/questions\/505015\/nginx-use-server-name-on-ssl-certificate-path<\/a><\/li>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/37994513\/nginx-ssl-certificate-permission-ssl-error-0200100dsystem\">https:\/\/stackoverflow.com\/questions\/37994513\/nginx-ssl-certificate-permission-ssl-error-0200100dsystem<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I got my Letsencrypt SSL certificate and wanted to configure Nginx to use it. I added listen 443 ssl and pointed ssl_certificate and ssl_certificate_key to the right files, using $server_name variable. listen 443 ssl; ssl_certificate \/usr\/local\/etc\/letsencrypt\/live\/$server_name\/fullchain.pem; ssl_certificate_key \/usr\/local\/etc\/letsencrypt\/live\/$server_name\/privkey.pem; The above didn&#8217;t work, giving me these cryptic errors: SSL_ERROR_INTERNAL_ERROR_ALERT in Firefox ERR_SSL_PROTOCOL_ERROR in Chrome Here&#8217;s what&hellip; <a class=\"more-link\" href=\"https:\/\/editjournal.redakt.eu\/faxmodem\/blog\/seo-webmaster\/nginx-ssl-error-permissions\/\">Continue reading <span class=\"screen-reader-text\">If Nginx cannot read your SSL certificate file<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[994],"tags":[1247,982],"class_list":["post-1721","post","type-post","status-publish","format-standard","hentry","category-seo-webmaster","tag-nginx","tag-ssl","entry"],"_links":{"self":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1721","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/comments?post=1721"}],"version-history":[{"count":3,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1721\/revisions"}],"predecessor-version":[{"id":1725,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1721\/revisions\/1725"}],"wp:attachment":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/media?parent=1721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/categories?post=1721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/tags?post=1721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}