[SOLVED] Lightsail/Bitnami mv: cannot stat ‘/opt/bitnami/apache2/conf/server.csr’: No such file or directory | Digital Conqueror

[SOLVED] Lightsail/Bitnami mv: cannot stat ‘/opt/bitnami/apache2/conf/server.csr’: No such file or directory

Recently one of the colleagues of mine started exploring Amazon Lightsail as VPS hosting solution for a WordPress website.  The major challenge for non-techies is, its an unmanaged hosting and he was trying to explore the default WordPress stack on Lightsail for learning.

While he was following a bunch of tutorials and learning on the go, there are definitely many small challenges in managing site without understanding the infrastructure, and I personally recommended him to get a basic understanding on Linux commands as well as unmanaged hosting.

Recently he encountered the problem of missing server.csr. The error code shows as follows –

mv: cannot stat ‘/opt/bitnami/apache2/conf/server.csr’: No such file or directory

He was simply installing SSL on Lightsail using a well-documented tutorial here – https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-using-lets-encrypt-certificates-with-wordpress#install-certbot-on-your-instance-wordpress

This stack basically uses Bitnami for quick preconfigured installation of WordPress.

He basically moved server.csr and server.key using the abovementioned tutorial, which misplaced the server.csr or made the file empty.

Now when he restarted the server using ” sudo /opt/bitnami/ctlscript.sh start”

Now that the file was missing or mislocated, Apache failed to restart. And now you’re locked out of the server, and site goes offline.

How I solved mv: cannot stat ‘/opt/bitnami/apache2/conf/server.csr’: No such file or directory

Part 1:

You can simply comment out the SSL links in the bitnami.conf located here – /opt/bitnami/apache2/conf/bitnami/bitnami.conf

 

And add a #symbol to comment out the links for server.crt and server.key

#SSLCertificateFile "/opt/bitnami/apache2/conf/server.crt"
#SSLCertificateKeyFile "/opt/bitnami/apache2/conf/server.key"

Now, you can try restarting the server with sudo /opt/bitnami/ctlscript.sh start

In many cases, this will resolve the issue. And you can restart the process of generating SSL again.

But in our case, it gave the error –  httpd could not be started

Part 2

In that case you can reverse the misplaced SSL key and certificate by typing following commands.

sudo mv /opt/bitnami/apache2/conf/server.crt.old /opt/bitnami/apache2/conf/server.crt
sudo mv /opt/bitnami/apache2/conf/server.key.old /opt/bitnami/apache2/conf/server.key
sudo mv /opt/bitnami/apache2/conf/server.csr.old /opt/bitnami/apache2/conf/server.csr
sudo /opt/bitnami/ctlscript.sh restart

Above commands places back the original files in place, and then you can get back with your website.

I would recommend taking a snapshot as well as general WordPress backup. Before reinstalling the SSL on your server.

A great resource to start back the SSL installation with Bitnami as per your stack configuration is this one instead of Lightsail documentation – https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/

I hope you get out of the missing file issue from the above instruction.

Amol Wagh

Author of Game Marketing Book: Market Your Indie Game Like A Pro! 7 years of Tech Blogging & Digital Marketing. Co-founder at Dotline Inc & a Gamer. Follow me on Twitter @amolwagh, @amol.wagh

0 Comments

No comments!

There are no comments yet, but you can be first to comment this article.

Leave reply

<