nginx cannot load certificate फुलचैन.पेम - Certbot फिक्स

त्रुटि nginx cannot load certificate path/fullchain.pem प्रमाण पत्र हटाने के बाद जब हम एनजीआईएनएक्स सेवा का परीक्षण करते हैं तो प्रकट होता है Let’s Encrypt के साथ उत्पन्न Certbot.

सर्वर में, त्रुटि इस तरह दिखाई देती है:

nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/example.com/fullchain.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/example.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed

पृष्ठभूमि nginx त्रुटि

पिछले लेख में मैंने दिखाया था कि आप कैसे से हटा सकते हैं Certbot डोमेन जो अतीत में सर्वर पर होस्ट किए गए थे लेकिन जो वर्तमान में सक्रिय नहीं हैं। पुराने डोमेन हटाएं Certbot certificates (आइए प्रमाणपत्र एन्क्रिप्ट करें).

जब आप प्रमाणपत्र हटाते हैं SSL कमांड द्वारा सक्रिय डोमेन के लिए, जो अभी भी सर्वर पर होस्ट किए जाते हैं: sudo certbot delete, प्रमाणपत्र स्वचालित रूप से हटा दिया जाता है, लेकिन सेवा के पुनरारंभ होने तक यह सत्रों में सक्रिय रहता है nginx. Nginx -t कमांड (सेवा का परीक्षण) के साथ आप आश्चर्यचकित हो सकते हैं कि उपरोक्त त्रुटि के साथ परीक्षण विफल हो गया। हालाँकि, समाधान बहुत सरल है।

nginx cannot load certificate
nginx cannot load certificate

फिक्स्ड nginx: [emerg] प्रमाणपत्र fullchain.pem लोड नहीं कर सकता

जब आप एक प्रमाणपत्र स्थापित करते हैं SSL Let’s Encrypt के माध्यम से Certbot, डोमेन के लिए nginx की कॉन्फ़िगरेशन फ़ाइल में, प्रमाणपत्र के अस्तित्व को इंगित करने वाली कुछ पंक्तियाँ जोड़ी जाती हैं। जब प्रमाणपत्र हटा दिया जाता है, तो लाइनें nginx कॉन्फ़िगरेशन में रहती हैं और मैन्युअल रूप से हटा दी जानी चाहिए। यानी नीचे दी गई पंक्तियां:

.....    

    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name example.com www.example.com;
    listen 80;
    return 404; # managed by Certbot

इन पंक्तियों को उस डोमेन की nginx confg फ़ाइल से हटाने के बाद जिसके लिए आपने प्रमाणपत्र हटा दिया था SSL, कमांड निष्पादित करें nginx -t यह जांचने के लिए कि क्या सब कुछ ठीक है।

[root@server]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@server]# 

अब आप सेवा को सुरक्षित रूप से पुनः आरंभ कर सकते हैं nginx.

तकनीकी प्रेमी के रूप में, मैं 2006 से StealthSettings.com पर खुशी से लेख लिख रहा हूँ। मेरे पास ऑपरेटिंग सिस्टम्स: macOS, Windows और Linux, साथ ही प्रोग्रामिंग भाषाओं और ब्लॉगिंग प्लेटफ़ॉर्म्स (WordPress) और ऑनलाइन स्टोर्स (WooCommerce, Magento, PrestaShop) के साथ विविध अनुभव है।

कैसे करें » Web Hosting » nginx cannot load certificate फुलचैन.पेम - Certbot फिक्स
एक टिप्पणी छोड़ दो