SSLCertificateFile: file '/opt/bitnami/apache2/conf/server.crt' does not exist or is empty apache config test fails

Keywords: WordPress - AWS - How to - Secure Connections (SSL/HTTPS)
Description:
I’m following this guide but I get stuck with an error:

error: AH00526: Syntax error on line 46 of
/opt/bitnami/apache2/conf/bitnami/bitnami.conf:
SSLCertificateFile: file '/opt/bitnami/apache2/conf/server.crt' does not exist
or is empty

here is my bitnami support ticket a5fe5b94-fd8d-bb3b-6260-20a548ba2672

Hi @keepmovingforward,

Can you let me know which guide did you follow and which step failed for you? In your support file, I don’t see any error regarding a missing server.crt file.

Did you already solve that issue?

1 Like

Hi, Still haven’t solve the problem…

Here is the guide that I’m following : https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/

When I do step 2 turning off Bitnami Services, after entering this code

sudo /opt/bitnami/ctlscript.sh stop

I get the error…

Hi @keepmovingforward,

The problem is that the dummy certificates bundled with the stack are missing. Maybe you have moved to a different folder, rename or delete them.

You can try re-generating it with the following commands and then continue following the guide.

  1. Generate a new private key:

    sudo openssl genrsa -out /opt/bitnami/apache2/conf/server.key 2048
    
  2. Create a certificate:

    sudo openssl req -new -key /opt/bitnami/apache2/conf/server.key -out /opt/bitnami/apache2/conf/cert.csr
    

    NOTE: When the above command asks for the “Common Name”, you can use example.com

  3. Create a temporary self-signed certificate:

    sudo openssl x509 -in /opt/bitnami/apache2/conf/cert.csr -out /opt/bitnami/apache2/conf/server.crt -req -signkey /opt/bitnami/apache2/conf/server.key -days 365
    

Hi @tomasp Thanks for the fast support,

I did the steps and on Step 2 it asked me to input a bunch of questions such as company name, country, email add, etc. Is this correct?

Also I did your steps, it says in the Site Information beside the URL of browser that I have Certificate from Let’s Encrypt but how come it still shows the “Your connection to this site is not secure”.

Thanks

Hi @keepmovingforward,

Yes, that is normal when you create a certificate. As you were creating a dummy certificate you could have entered whatever you want. You would only need to specify a domain for the Common Name.

I see that your certificate is properly configured now. However, the browser still shows the page as not secure because of a mixed content issue. This happens when you access the page using https:// but there are some resources (usually images, css or javascript files) that are still loaded using plain http://.

Usually, this can be addressed by configuring your domain name using the proper protocol in the file /opt/bitnami/apps/wordpress/htdocs/wp-config.php.

Can you change the following code in that file?

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');

to

define('WP_SITEURL', 'https://domain.com/');
define('WP_HOME', 'https://domain.com/');

Of course, replace domain.com by your real domain and note the protocol specified is https://

On another topic, you may also be interested on force HTTPS access to your website. If so, please check this guide.

Hi I changed the code to what you suggested, site is still not secure.

If I force HTTPS access to my website like what you said on this guide, will that resolve my problem with some resources (usually images, css or javascript files) that are still loaded using plain http:// ?

Thanks

Sometimes it is also necessary to update the domain in the database. Do you mind executing the following command to see if your domain is properly configured in the database?

mysql -u root -p bitnami_wordpress -e "select * from wp_options where option_name='home' || option_name='siteurl';"

When executing the previous command, you will be asked for the mysql root user password. This password should be the same you use to log in to your WordPress as administrator.

If your domain name is not properly configured, you can update the values with these commands:

mysql -u root -p bitnami_wordpress -e 'UPDATE wp_options SET option_value="https://domain.com" WHERE option_name="home"'
mysql -u root -p bitnami_wordpress -e 'UPDATE wp_options SET option_value="https://domain.com" WHERE option_name="siteurl"'

Remember to replace domain.com by your real domain.

No. But it won’t allow users to access using plain HTTP.

1 Like

I did what this

mysql -u root -p bitnami_wordpress -e "select * from wp_options where option_name='home' || option_name='siteurl';"

It showed me the siteurl and home is pointing to 127.0.0.1, the I did the second step, now it is configured to my website.

Everything works for Firefox and Edge browser… but still having problems with Google Chrome

Is it because I changed my the site ip address before and now some old ip address of the font gets called…?

Really appreciate your help. Thanks!

Hi, @keepmovingforward.

If it works correctly in Firefox and Edge but not in Google Chrome, probably there’s some data cached on your Google Chrome browser. Try again after cleaning the cache.

Regards,
Alejandro

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.