HELP! Let's Encrypt and CloudFlare: Error 526 when using Full(Strict) SSL. (Ubuntu 16.04 & Apache)

My domain is: www.addictivebakes.com

Here’s the details:
I’m was trying to configure Let’s Encrypt together with Cloudflare, and everything went well, and I got the let’s Encrypt cert following this tutorial ( https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04).
I then went on to switch my SSL mode to Full (Strict) on Cloudflare.
However, I got the Error 526 when accessing the site (addictivebakes.com).

I then purged python-certbot-apache, and did this:

  1. wget https://dl.eff.org/certbot-auto
  2. chmod a+x certbot-auto
  3. ./certbot-auto certonly – webroot --webroot-path /var/www/html/ --renew-by-default --email name@addictivebakes.com --text --agree-tos -d addictivebakes.com -d www.addictivebakes.com

I got the congratulations message again and it says that I’ve gotten the SSL certificate.

However, I still face these issues:

  1. When I try to access https://addictivebakes.com, I get Error 526. My Cloudflare is set to Full(Strict) SSL. I’m able to access my site when it’s set to Full SSL instead of Full(Strict) SSL.

  2. Although I put in the option for all requests to redirect to secure HTTPS access, when I access my site (addictivebakes.com), it doesn’t redirect me automatically to https://addictivebakes.com)

How do I get my site working with Full (Strict) SSL, and have all requests redirect to https://addictivebakes.com? Thanks!

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

  • Ubuntu 16.04
  • Apache

My hosting provider is:
Digital Ocean

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

Could you show the Apache configuration?

And, if possible, temporarily disable Cloudflare’s orange cloud to expose the origin and run https://www.ssllabs.com/ssltest/ ?

Edit: For me, http://addictivebakes.com/ redirects to https, but http://www.addictivebakes.com/ does not.

1 Like

Hi! Thanks for the response.

I’m very new to this and am unsure how I can show the Apache configuration.
I used Digital Ocean’s One-Click Install WordPress App. How do I show the Apache configuration?
Also, I had disabled Cloudflare’s orange cloud and ran https://www.ssllabs.com/ssltest/ . I left it disabled for your reference.

Thanks for checking. Any idea how I can have http://www.addictivebakes.com/ to redirect to https?

Your help is much appreciated!

EDIT:
**The issue lies with the Lets Encrypt Configuration. **
I’ve decided to revoke the Let’s Encrypt Cert, Purge it, and start again. Does anyone know the exact command I can run to revoke the Cert? Thanks!

Well... it depends. I don't know how DigitalOcean set it up. Read their documentation, or look around in /etc/apache2 or /etc/httpd or a similar location.

It looks largely fine...

I notice that, when the SSL Labs test was run, it was using a certificate that only matched addictivebakes.com, issued at 10:35. Since Cloudflare's Full (strict) setting checks the names, that would work for https://addictivebakes.com/ but result in an error on https://www.addictivebakes.com/.

A certificate covering both names was issued at 13:55 but, at the time the test was run, the Apache server wasn't using it, or at least wasn't using it for https://addictivebakes.com/ (which is, after all, fine). I have no idea if it was using the other certificate for https://www.addictivebakes.com/.

Anyway, Apache being configured to use the wrong certificate could be the problem.

I'd like to see the output of "./certbot-auto certificates" and the Apache configuration for the site.

It could be Apache is configured correctly, but needs to be reloaded (or restarted).

Well, the useless, vague answer is "make some changes to the Apache configuration". Precisely what changes depends on the current configuration, but probably something like changing the virtual host to use "Redirect / https://www.addictivebakes.com/".

You don't need to revoke the certificate. Revoking doesn't make it easier -- or harder -- to issue a new certificate. But FYI Certbot has a "revoke" command.

Edit:

And you probably don't need to start again. There should always be a (sometimes more complicated) way to solve things.

Also, keep in mind the rate limits when repeatedly issuing certificates. A rate limit mishap is one reason it's safer to move and save the files instead of deleting them. (And not to revoke old certificates unless truly necessary.)

1 Like

Hi, This is the output when I run cat /etc/apache2/apache2.conf . (I believe this displays the Apache configuration for the site.

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#       /etc/apache2/
#       |-- apache2.conf
#       |       `--  ports.conf
#       |-- mods-enabled
#       |       |-- *.load
#       |       `-- *.conf
#       |-- conf-enabled
#       |       `-- *.conf
#       `-- sites-enabled
#               `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

The output of “./certbot-auto cerificates” returns this:

Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Found the following certs:
  Certificate Name: addictivebakes.com
    Domains: addictivebakes.com www.addictivebakes.com
    Expiry Date: 2017-09-23 16:40:00+00:00 (VALID: 89 days)
    Certificate Path: /etc/letsencrypt/live/addictivebakes.com/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/addictivebakes.com/privkey.pem
-------------------------------------------------------------------------------

Hope this provides the information you’d need to help me solve this issue!
Once again, I really appreciate your help.

Note: By the way, I switched off CloudFlare for the site in the mean time.

It’s definitely using the older certificate. That’s definitely a problem, and it might be the only problem.

Apache has a lot of configuration files. Could you provide, in order of most to least important, the files in sites-enabled, the files in conf.d, and ports.conf? And any other important files that they Include

When was the last time Apache was reloaded or restarted? If it was before the 13:55 certificate was issued, that might be all you need to do. (Aside from the redirect configuration.)

Edit: “certbot certificates” looks good, though.

2 Likes

I reloaded apache and it works fine now! Turns out to be a simple solution… so glad you spotted it.

Now my site is able to run on Full(Strict) SSL with Let’s Encrypt Certificate.

Thank you so much!:smile:

Note: As for the redirect configuration, as I’m running wordpress site, I downloaded the WP Force SSL plugin. Works perfectly.

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