Found Gateway 502 error on an AlmaLinux 8 server with nginx+apache. Logs were full of lines of the following kind:
[error] 1387293#0: *28 SSL_do_handshake() failed (SSL: error:0A00042E:SSL routines::tlsv1 alert protocol version:SSL alert number 70) while SSL handshaking to upstream, client: 126.96.36.199, server: web.example.com, request: "GET / HTTP/2.0", upstream: "https://188.8.131.52:8081/", host: "web.example.com"
Fix for Directadmin servers
Servers without DirectAdmin might have other files which you can update.
Anyway you need to add the following lines in Nginx configuration:
proxy_ssl_protocols TLSv1.2 TLSv1.3;
and restart the webserver.