Cert not working without www


#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: www.zedelitoral.com / zedelitoral.com

I ran this command: Followed this instructions> https://certbot.eff.org/lets-encrypt/centosrhel7-apache

It produced this output: I can’t remember

My web server is (include version): Apache/2.4.6

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

My hosting provider, if applicable, is: One of the shareholders of my company

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

Extra> >result of certbot certificate

[root@zedelitoral ~]# certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Cannot extract OCSP URI from /etc/letsencrypt/live/zedelitoral.ec/cert.pem


Found the following certs:
Certificate Name: zedelitoral.ec
Domains: zedelitoral.ec www.zedelitoral.ec
Expiry Date: 2018-10-07 15:20:36+00:00 (VALID: 87 days)
Certificate Path: /etc/letsencrypt/live/zedelitoral.ec/fullchain.pem
Private Key Path: /etc/letsencrypt/live/zedelitoral.ec/privkey.pem


#2

If you want the cert to work with both zedelitoral.ec and www.zedelitoral.ec, you’ll need to have both names on the certificate.


#3

Hi @mvelasco93

your certificate is created correct with two names.

https://transparencyreport.google.com/https/certificates/STKWHBTmr7VYV5A21XITg%2FJLWj8u2%2FZ51U7MtarfWXQ%3D

https://www.zedelitoral.ec/ is correct and uses this certificate.

But https://zedelitoral.ec/ uses a self-signed certificate.

So your Apache-configuration of zedelitoral.ec is wrong.


#4

Do you know a guide for what can I check to correct this? Thanks in advance.


#5

The Apache Documentation should help.

What’s your configuration of www.zedelitoral.ec and zedelitoral.ec

zedelitoral.ec may have the wrong certificate files.


#6

httpd.conf > https://pastebin.com/raw/WZVebUs6
sites-available/zedelitoral.ec.conf > https://pastebin.com/raw/wK7LZQmb


#7

Hi @mvelasco93,

Regarding this conf:

<VirtualHost *:80>
ServerAdmin info@zedelitoral.ec
ServerName zedelitoral.ec
ServerAlias *.zedelitoral.ec
DocumentRoot /var/www/html/drupal
    ErrorLog logs/error.log
    CustomLog logs/access.log combined

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www.\.
RewriteRule ^/(.*)$  http://www.zedelitoral.ec$1 [R=301]
</VirtualHost>

If you use RewriteCond %{HTTPS} on on a VirtualHost that is not using TLS it never will match that condition, also RewriteCond %{HTTP_HOST} !^www.\. is not correct you should remove the first dot RewriteCond %{HTTP_HOST} !^www\.

If you only want to redirect all domains to https:///www.zedelitoral.ec remove those rules and add a Redirect.

<VirtualHost *:80>
ServerAdmin info@zedelitoral.ec
ServerName zedelitoral.ec
ServerAlias *.zedelitoral.ec
DocumentRoot /var/www/html/drupal
    ErrorLog logs/error.log
    CustomLog logs/access.log combined
Redirect permanent / https://www.zedelitoral.ec/
</VirtualHost>

Regarding the certificate issue with domains that are not wwww., could you please show this conf file /etc/httpd/sites-available/zedelitoral.ec-le-ssl.conf?.

Cheers,
sahsanu


#8

I’ll correct the vh conf.

This the ec-le-ssl.conf > https://pastebin.com/raw/HLRhDMnW


#9

I see no problem with that conf. Remember to reload or restart the Apache WebServer once you have modified the conf files.


#10

I had done the redirect thing. So for now, it solves the problem. Thanks!


#11

Great, now you need to know the reason why https://zedelitoral.com is not showing the right cert, I suppose you have defined it on another ServerName or ServerAlias taking precedence to zedelitoral.ec-le-ssl.conf

As a quick test you could edit httpd.conf file and change the order of the includes:

Before:

IncludeOptional conf.d/*.conf
IncludeOptional sites-enabled/*.conf
Include /etc/httpd/sites-available/zedelitoral.ec-le-ssl.conf

After:

Include /etc/httpd/sites-available/zedelitoral.ec-le-ssl.conf
IncludeOptional conf.d/*.conf
IncludeOptional sites-enabled/*.conf

Restart Apache and try again.

Anyway, could you please execute this command and show the output?.

grep -Ri zedelitoral /etc/httpd/*

Cheers,
sahsanu


#12

I have changed the httpd conf right now.

As of the result of the grep, it was pretty extensive so the last 2000 lines were copied https://pastebin.com/N0VWUpj5


#13

Great, https://zedelitoral.ec works fine from my side


#14

Thank you! I will leave the redirect so it follows the www site now. If a mod check this, you can close it.


#15

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