Sometimes my SSL doesn't working properly?

My domain is: I have created a subdomain it was working fine but suddenly it stops this is the second time it is happening

I ran this command: sudo certbot --apache -d to create a new certificate and where I got the success message, the server is working on ubuntu 18.04

My hosting provider, if applicable, 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

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

What should I do it is working fine on the main domain but I am facing these issues on subdomains.

Hi @bhavikji

there are some errors in your configuration (checked via ):

You have an ipv4 and ipv6

Host T IP-Address is auth. ∑ Queries ∑ Timeout A yes 1 0
AAAA 2400:6180:100:d0::88b:e001 yes Name Error yes 1 0

But there are different http status results:

Domainname Http-Status redirect Sec. G
2400:6180:100:d0::88b:e001 301 0.283 A 200 0.924 H 200 2.953 B
2400:6180:100:d0::88b:e001 -4 0.593 W
SendFailure - The underlying connection was closed: An unexpected error occurred on a send. The handshake failed due to an unexpected packet format. 400 0.310 Q
Bad Request
2400:6180:100:d0::88b:e001 200 0.313 Q
2400:6180:100:d0::88b:e001 301 0.284 A 404 0.297 A
Not Found -4 0.576 W
SendFailure - The underlying connection was closed: An unexpected error occurred on a send. The handshake failed due to an unexpected packet format.

Ipv6 + http has a redirect, ipv4 + http not. https + ipv6 is wrong, port 443 answers with http content (instead of https).

Is your ipv6 configured? If not, remove the ipv6 address.

https works only with ipv4 correct.

But your /.well-known/acme-challenge is redirected to https. Letsencrypt prefers ipv6, a wrong certificate isn't a problem. Sending http over port 443 is a problem.

thanks for the response @JuergenAuer, I my ipv6 is enabled so in that case what could I can do to fix this issue?

1 Like

Check your listen directives:

Listen [::]:80
Listen [::]:443

Same with your vHost-blocks.

@JuergenAuer where I will find these directives any help you can offer?

Also now I tested over this
and found is name error is resolved but it is pointing http to 443 port @jurgenhaas

This "name error" isn't a problem. The comment:

A DNS: "Name Error" means: No www-dns-entry defined. This isn't a problem

The subdomain doesn't have a www-version, there would be the same "Name Error".

In one of your Apache config files.

ok I checked in etc/apache2/ports.conf

there it is listening to correct ports the entire file looks like

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80

<IfModule ssl_module>
        Listen 443

<IfModule mod_gnutls.c>
        Listen 443

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

and I am pretty sure that vhosts are pointed to the same port as in conf files ( points to *:80) and whereas ( points to

is it the right place where I looked?

@JuergenAuer if they are fine then what is the actual problem here?

Tthis specficly binds only to an IPv4 IP:

If you want to use both IPv4 and IPv6, you will need to include both.
Change the vhost block like:
<VirtualHost *:80 [::]:80>
<VirtualHost *:443 [::]:443>

And don't include the port after a servername.
servername www.mydomain:443
[this is bad practice]

@rg305 I have subdomains so for I can't put *:443 I put the port after ip in vhost. however even after that the ports are redirecting correctly but I am facing the issue.

I don't understand what "subdomains" have to do with IP:port bindings.

Ok,then if you need both IPv4 and IPv6, then put both your IPs and their ports in the vhost block:
Something like this example (change to your IPs):
<VirtualHost [2001:4321:abcd::1ab2]:80>
[but this is usually not recommended for reasons like IPs can change, what if the real IP is NOT on the host (host is behind NAT)]

It really is much simpler to use * than to type the IPs into every vhost block.
[and it is far too easy to making a typing mistake - especially with long IPv6 addresses]

@rg305 earlier I was facing issue in redirection so to avoid that I have to put IP in vhost for subdomain because even from subdomain it was redirecting back to main domain. what are the best practices to working with subdomains?

That sounds like the redirection is not correct.
I would start looking at that first.
Make sure it does exactly what you want it to do, then continue with cert request(s).

You can show the redirections here if you need help (or opinion) with them.

@rg305 for that do I need to remove existing certs? and try work with http first?

Do not remove valid certs - that is like taking steps backwards.
[you will be going in wrong direction]

Show the problem area(s) that you have (or had).
And what you did to try to fix.

@rg305 when first I created subdomain it was redirecting back to main domain I had words with DO and they told me there is some issue in SSL which I figured out that vhost is redirecting all request to main domain using *:443 to fix that thing I added ipv4 with :443 request now I am facing this issue which I have added here. I have 2 subdomains and none of them is working properly.

Sounds like the “fix” only works by luck or chance.
Apache is notorious for running at all cost - it will allow almost any misconfiguration to pass.

Can you show the full config?
Or go piece by piece…
starting with the main config file:

it was just a problem of default.conf

all I need to hit this command

sudo a2dissite 000-default.conf

Thanks for your time guys

1 Like

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