Nginx Letsencrypt OpenSSL Error on new Ubuntu 22.04 "unexpected eof while reading"

Hi all,

after an Ubuntu-Server upgrade on 22.04, which came along with a new php-Version (from 7.4 to 8.x) and an openssl Version (from 1.1.1 to 3.0.2) I experience the follwoing error message:

2022/05/05 10:34:29 [crit] 925#925: *6508 SSL_read() failed (SSL: error:0A000126:SSL routines::unexpected eof while reading) while keepalive, client:, server:```
php seems to be configured like this:

sudo update-alternatives --config php
Es gibt 3 Auswahlmöglichkeiten für die Alternative php (welche /usr/bin/php bereitstellen).

Auswahl Pfad Priorität Status

0 /usr/bin/php8.1 81 automatischer Modus
1 /usr/bin/php7.4 74 manueller Modus

  • 2 /usr/bin/php8.0 80 manueller Modus
    3 /usr/bin/php8.1 81 manueller Modus
What is the best way to get rid of the error?

Regards and thank-you,


I found this for you. Maybe the included answer helps you.

Thank-you all and devnull…
Unfortunately the respective link did not help because I don’t understand what to do in order to avoid the error:

SSL: error:0A000126:SSL routines::unexpected eof while reading

Ich would like t know what to do…




you can find some discussion relative to this kind of bug here:

Also, on my personnal expĂŞrience, check if port 80 and 443 are unused while querying the ssl cert.

Hi all, hi stratege1401,

check if port 80 and 443 are unused while querying the ssl cert.
How do I do that?

By the way I have seen that apache2 was (wizardly) installed although I use nginx.
I removed apache 2 (apt remove apache2), but no improvement.

I know the post on github, but I neither understand nor can discover what to do??!!


I had the same issue with my fresh Ubuntu 22.04 installation after installing nginx right away from the system repository. It turned out this wasn’t the very latest version (V1.18 or so).

After installing mainline V1.21.6 from Ondrejs PPA the issue was gone for good. Thanks to the instruction in

NB: I wasn’t able to install nginx from the official repository using the gpg key.