Apache HTTPS Certbot LetsEncrypt issue


#1

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. https://crt.sh/?q=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: mailer9.com

I ran this command: sudo certbot --apache

It produced this output: Successful

My web server is (include version): Apache 2.4.29

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

My hosting provider, if applicable, is: Linode

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


I am trying to set up a website with HTTPS on a Linode server. It’s working on HTTP but not on HTTPS.

I tried to use Certbot to configure my domain for HTTPS.

root@mailer9:/etc/apache2/sites-enabled# sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: mailer9.com
2: www.mailer9.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 
Attempting to parse the version 0.29.1 renewal configuration file found at /etc/letsencrypt/renewal/mailer9.com.conf with version 0.28.0 of Certbot. This might not work.
Cert not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/mailer9.com.conf)

What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for mailer9.com
http-01 challenge for www.mailer9.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/apache2/sites-enabled/mailer9.com-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-enabled/mailer9.com-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Your existing certificate has been successfully renewed, and the new certificate
has been installed.

The new certificate covers the following domains: https://mailer9.com and
https://www.mailer9.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=mailer9.com
https://www.ssllabs.com/ssltest/analyze.html?d=www.mailer9.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/mailer9.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/mailer9.com/privkey.pem
   Your cert will expire on 2019-04-02. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

root@mailer9:/etc/apache2/sites-enabled# 

It says that thing should be working fine but it’s not working in HTTPS mode.

I see two VH files in sites-enabled directory.

root@mailer9:/etc/apache2/sites-enabled# cat mailer9.com.conf 
# domain: mailer9.com
# public: /var/www/html/mailer9.com/public_html/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin xxx@yy.com
  ServerName  mailer9.com
  ServerAlias www.mailer9.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/mailer9.com/public_html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/mailer9.com/log/error.log
  CustomLog /var/www/html/mailer9.com/log/access.log combined

#RewriteEngine on
#RewriteCond %{SERVER_NAME} =mailer9.com [OR]
#RewriteCond %{SERVER_NAME} =www.mailer9.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Another one for HTTPS, auto-generated by Certbot.

root@mailer9:/etc/apache2/sites-enabled# cat mailer9.com-le-ssl.conf 
<IfModule mod_ssl.c>
<VirtualHost *:443>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin xxx@yy.com
  ServerName  mailer9.com
  ServerAlias www.mailer9.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/mailer9.com/public_html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/mailer9.com/log/error.log
  CustomLog /var/www/html/mailer9.com/log/access.log combined


SSLEngine on
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/mailer9.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mailer9.com/privkey.pem
</VirtualHost>
</IfModule>
root@mailer9:/etc/apache2/sites-enabled# 

However, if I visit http://mailer9.com/ then it works fine. But if I go to https://mailer9.com/ the page doesn’t load. I am clueless about how to solve it, everything looks fine to me.

Apache modules command apachectl -M shows ssl_module is loaded.


#2

Hi @JournalDev

yep, there are two timeouts:

Domainname Http-Status redirect Sec. G
http://mailer9.com/
23.92.25.161 200 0.344 H
http://www.mailer9.com/
23.92.25.161 200 0.346 H
https://mailer9.com/
23.92.25.161 -14 10.047 T
Timeout - The operation has timed out
https://www.mailer9.com/
23.92.25.161 -14 10.026 T
Timeout - The operation has timed out

But your certificate exists.

https://transparencyreport.google.com/https/certificates?cert_search_auth=&cert_search_cert=&cert_search=include_expired:false;include_subdomains:false;domain:mailer9.com&lu=cert_search

Is there a firewall? Or a wrong router forwarding?


#3

Yes, it was causing because of ufw firewall. I allowed 443 port by following commands and it started working fine.

sudo ufw allow 443/tcp

Thanks for your input regarding firewall, it helped me in fixing this.


closed #4

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