Because of LE SSL apache failing to start after instance reboot

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: marketinghouse.ge

I ran this command:

sudo /opt/bitnami/ctlscript.sh restart

It produced this output:

Job for bitnami.service failed because the control process exited with error code.
See "systemctl status bitnami.service" and "journalctl -xe" for details.

My web server is (include version):

The operating system my web server runs on is (include version):

My hosting provider, if applicable, is: AWS lightsail

I can login to a root shell on my machine (yes or no, or I don't know): YES

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): NO

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):

-bash: certbot-auto: command not found

Hi @Merkucio, and welcome to the LE community forum :slight_smile:

Please show the output of these two commands:

3 Likes

The reply post seems to cutoff after 90 chars width.

3 Likes

OK, after

systemctl status bitnami.service

And after

journalctl -xe

I can see better now, thanks.

How was the cert installed?

3 Likes

Forget about certbot. On bitnami images you should use bncert, their own tool.

3 Likes

Yes, I remember that I use this command

sudo /opt/bitnami/bncert-tool

Please, help.

The error shows a problem starting Apache. Can you show the contents of the main Apache config file? I am not sure where it is on bitnami but it might be:

/opt/bitnami/apache2/conf/httpd.conf 

Please put 3 backticks before and after this config output to ensure it formats correctly.

Also, what does this command show

sudo apachectl -t -D DUMP_VHOSTS

It might require apache2ctl or httpd instead of apachectl.

4 Likes

Thanks for your reply

/opt/bitnami/apache2/conf/httpd.conf 

1 Like
sudo apachectl -t -D DUMP_VHOSTS

sudo apache2ctl -t -D DUMP_VHOSTS

sudo httpd -t -D DUMP_VHOSTS

And about the syntax error

sudo nano /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf

~~OK, I see you are not skilled in server admin. I will be more careful in my instructions. Can you show contents of this file:

/opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf

Show the contents by copy/paste to a post here. And, place 3 backticks before and after the output like:
```
contents of that conf file
```
You may need to open that file in an editor or use the cat command and copy/paste its output:

cat /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf

~~

3 Likes
<VirtualHost 127.0.0.1:443 _default_:443> ServerName www.example.com ServerAlias *
SSLEngine on SSLCertificateFile "/opt/bitnami/apache/conf/marketinghouse.ge.crt"
SSLCertificateKeyFile "/opt/bitnami/apache/conf/marketinghouse.ge.key"
DocumentRoot /opt/bitnami/wordpress
  # BEGIN: Configuration for letsencrypt
Include "/opt/bitnami/apps/letsencrypt/conf/httpd-prefix.conf"
  # END: Configuration for letsencrypt
  # BEGIN: Support domain renewal when using mod_proxy without Location
<IfModule mod_proxy.c>
ProxyPass /.well-known !
</IfModule>
  # END: Support domain renewal when using mod_proxy without Location
  # BEGIN: Enable non-www to www redirection
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^localhost
RewriteCond %{HTTP_HOST} !^[0-9]+.[0-9]+.[0-9]+.[0-9]+(:[0-9]+)?$
RewriteCond %{REQUEST_URI} !^/\.well-known
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]
  # END: Enable non-www to www redirection
<Directory "/opt/bitnami/wordpress">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride None
Require all granted
    # BEGIN WordPress fix for plugins and themes
    # Certain WordPress plugins and themes do not properly link to PHP files because of symbolic links
    # https://github.com/bitnami/bitnami-docker-wordpress-nginx/issues/43
    RewriteEngine On
    RewriteRule ^bitnami/wordpress(/.*) $1 [L]
    # END WordPress fix for plugins and themes
    # BEGIN WordPress
    # https://wordpress.org/support/article/htaccess/#basic-wp
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

No, screenshot ok. I was posting while you posted and did not see it.

If you copy/pasted I could more easily show what is wrong. But, the problem is at the top of that conf file each of those settings should be on their own line.

You need to fix that conf file and get a successful sudo apachectl -t result before you can proceed to getting a cert

3 Likes

I pasted the file content above. Is it ok?

Maybe this is better...

Last login: Wed Sep 28 14:05:23 2022 from 54.239.6.8
bitnami@ip-172-26-13-168:~$ cat /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf
<VirtualHost 127.0.0.1:443 _default_:443> ServerName www.example.com ServerAlias * 
  SSLEngine on SSLCertificateFile "/opt/bitnami/apache/conf/marketinghouse.ge.crt" 
  SSLCertificateKeyFile "/opt/bitnami/apache/conf/marketinghouse.ge.key" 
  DocumentRoot /opt/bitnami/wordpress
  # BEGIN: Configuration for letsencrypt
  Include "/opt/bitnami/apps/letsencrypt/conf/httpd-prefix.conf"
  # END: Configuration for letsencrypt
  # BEGIN: Support domain renewal when using mod_proxy without Location
  <IfModule mod_proxy.c>
    ProxyPass /.well-known !
  </IfModule>
  # END: Support domain renewal when using mod_proxy without Location
  # BEGIN: Enable non-www to www redirection
  RewriteEngine On
  RewriteCond %{HTTP_HOST} !^www\. [NC]
  RewriteCond %{HTTP_HOST} !^localhost
  RewriteCond %{HTTP_HOST} !^[0-9]+.[0-9]+.[0-9]+.[0-9]+(:[0-9]+)?$
  RewriteCond %{REQUEST_URI} !^/\.well-known
  RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=permanent,L]
  # END: Enable non-www to www redirection
  <Directory "/opt/bitnami/wordpress">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride None
    Require all granted
    # BEGIN WordPress fix for plugins and themes
    # Certain WordPress plugins and themes do not properly link to PHP files because of symbolic links
    # https://github.com/bitnami/bitnami-docker-wordpress-nginx/issues/43
    RewriteEngine On
    RewriteRule ^bitnami/wordpress(/.*) $1 [L]
    # END WordPress fix for plugins and themes
    # BEGIN WordPress
    # https://wordpress.org/support/article/htaccess/#basic-wp
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
  </Directory>
  Include "/opt/bitnami/apache/conf/vhosts/htaccess/wordpress-htaccess.conf"
  # BEGIN: Support domain renewal when using mod_proxy within Location
  <Location /.well-known>
    <IfModule mod_proxy.c>
      ProxyPass !
    </IfModule>
  </Location>
  # END: Support domain renewal when using mod_proxy within Location
</VirtualHost>
bitnami@ip-172-26-13-168:~$