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: 2.3.4.5, server: web.example.com, request: "GET / HTTP/2.0", upstream: "https://1.2.3.4: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;
proxy_ssl_ciphers DEFAULT;
and restart the webserver.