soccerway
soccerway

Reputation: 12011

Cannot load cannot load certificate key PEM_read_bio_PrivateKey failed

Login into GoDaddy account and downloaded the certificates, combined those two certificates using cat command and created a combined.crt certificate. Later I have copied the combined.crt and simplelife.key.txt files in to the ssl location

Also checked the below configuration for sites-available:

  1. sudo nano /etc/nginx/sites-available/simplelife.com.au

    ##Redirect HTTP to HTTPS server { listen 80; server_name simplelife.com.au www.simplelife.com.au; return 301 https://$host$request_uri; }

    ##HTTPS Server Block server { listen 443 ssl; server_name simplelife.com.au www.simplelife.com.au;

     ssl_certificate /var/www/ssl/combined.crt;
     ssl_certificate_key /var/www/ssl/simplelife.key
    
     ### Other SSL settings
    
     root /var/www/simplelife.com.au/build;
     index index.html;
    
     location / {
         try_files $uri /index.html;
     }
    
     location /service {
         proxy_pass http://localhost:8000;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection 'upgrade';
         proxy_set_header Host $host;
         proxy_cache_bypass $http_upgrade;
     }
    

    }

2 . sudo nano /etc/nginx/sites-available/default

server {
    listen 80;
    server_name simplelife.com.au www.simplelife.com.au;
    root /var/www/simplelife.com.au/build;
    index index.html;
}

While running the systemctl status nginx.service in the Vultr server, throws below error, could someone please advise the reason for the error ?

● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2024-04-14 12:21:23 UTC; 7min ago Docs: man:nginx(8) Process: 8361 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Apr 14 12:21:23 simplelife systemd[1]: Starting A high performance web server and a reverse proxy server... Apr 14 12:21:23 simplelife nginx[8361]: nginx: [emerg] cannot load certificate key "/var/www/ssl/628f50dbfca5986c.pem": PEM_read_bio_PrivateKey() failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: ANY PRIVATE KEY) Apr 14 12:21:23 simplelife nginx[8361]: nginx: configuration file /etc/nginx/nginx.conf test failed

Upvotes: 0

Views: 616

Answers (0)

Related Questions