letsencrypt renewal fails ubuntu server (LAMPP installation)

272 views Asked by At

If I test the certbot renewal, it fails.

It fails with sudo certbot renew --dry-run

and also fails with:

sudo certbot renew --cert-name "www.mywebsite.com" --apache --apache-bin /opt/lampp/bin/httpd --apache-server-root /opt/lampp/etc/ --dry-run

Trying to find a solution, when I add this line Include "/opt/lampp/apache2/conf/httpd.conf"

at the end of the file /opt/lampp/etc/httpd.conf and then restart Apache with /op/lampp restart i get this error:

Starting XAMPP for Linux 7.3.33-0...
XAMPP: Starting Apache...fail.
AH00526: Syntax error on line 7 of /etc/letsencrypt/options-ssl-apache.conf:
SSLEngine not allowed in <Directory> context

I ask for help to know where to start looking for the solution.

I try to provide the content of some meaningful files.

This is file /opt/lampp/apache2/conf/httpd.conf

Alias /bitnami/ "/opt/lampp/apache2/htdocs/"
Alias /bitnami "/opt/lampp/apache2/htdocs"

<Directory "/opt/lampp/apache2/htdocs">
    Include /etc/letsencrypt/options-ssl-apache.conf
    Options Indexes FollowSymLinks
   #Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

This is the file /etc/letsencrypt/options-ssl-apache.conf

# This file contains important security parameters. If you modify this file
# manually, Certbot will be unable to automatically provide future security
# updates. Instead, Certbot will print and log an error message with a path to
# the up-to-date file that you will need to refer to when manually updating
# this file.

SSLEngine on

# Intermediate configuration, tweak to your needs
SSLProtocol             all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
SSLHonorCipherOrder     off

SSLOptions +StrictRequire

# Add vhost name to log entries:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

This is /opt/lampp/etc/extra/httpd-vhosts.conf

<VirtualHost *:80>

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%www.mywebsite.com/$1 [R=301,L] 

</VirtualHost>

<VirtualHost *:443>

    #SSLEngine On
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/www.mywebsite.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.mywebsite.com/privkey.pem

    ErrorLog "logs/123.online-server.cloud-error_log"
    CustomLog "logs/123.online-server.cloud-access_log" common
</VirtualHost>

UPDATE: Thanks to Eaten in the comments, he noticed what I missed. Sadly now I get this error:

XAMPP: Starting Apache...fail.
XAMPP:  Starting diagnose... 
XAMPP: Your /etc/hosts is not okay. I will fix it.
XAMPP:  Next try...
XAMPP: Starting Apache...fail.
0

There are 0 answers