No se pudo conectar al puerto 443 del servidor: conexión rechazada

No se pudo conectar al puerto 443 del servidor: conexión rechazada

Tengo un servidor web ejecutándose en mi servidor en 127.0.0.1:8088 y quiero acceder a él desde Internet.

Salida de ss -nplut con el servidor web en ejecución:

tcp LISTEN 0 1024 127.0.0.1:8088 0.0.0.0:* users:(("ctprods",pid=2042,fd=9))

Salida ss -nplut |grep 443

tcp LISTEN 0 511 *:443 *:*

Creé un host virtual de Apache (sitio habilitado, Apache recargado):

<VirtualHost *:443>
 # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    ServerName cyprientaque.com
    ServerAlias ctprods.cyprientaque.com

    ServerAdmin [email protected]

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.

#       RewriteCond %{SERVER_NAME} =ctprods.cyprientaque.com
#       RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

     <Proxy *>
             Require all granted
     </Proxy>
             ProxyPass / http://127.0.0.1:8088/
             ProxyPassReverse / http://127.0.0.1:8088/

SSLCertificateFile /etc/letsencrypt/live/ctprods.cyprientaque.com-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/ctprods.cyprientaque.com-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

Creé un certificado SSL con lets encrypt:

Certificate Name: ctprods.cyprientaque.com-0001
Serial Number: 39538aec7472a644e8d22887f858de17177
Domains: ctprods.cyprientaque.com
Expiry Date: 2020-11-17 10:59:58+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/ctprods.cyprientaque.com-0001/fullchain.pem
Private Key Path: /etc/letsencrypt/live/ctprods.cyprientaque.com-0001/privkey.pem

Tengo un registro A en mi proveedor de DNS para ctprods.cyprientaque.com que apunta a la IP de mi servidor

Pero cuando intento acceder a mi servidor con curl, aparece un error:

$ curl -X GET https://ctprods.cyprientaque.com/projects
curl: (7) Failed to connect to ctprods.cyprientaque.com port 443: Connection refused 

Y no puedo ver la solicitud tcpdump puerto 443.

Respuesta1

Su Apache no está escuchando en el puerto 443. Configuró su VirtualHost solo para HTTP, no para HTTPS. Configure un segundo VirtualHost con el puerto 443 y sus certificados y asegúrese de tener una Listen 443directiva en su configuración de Apache. Sus certificados no pertenecen al :80VirtualHost.

Lo anterior se basó en información incorrecta en la pregunta. Independientemente de lo que haya hecho mientras tanto, su servidor ahora se puede recargar a través de HTTPS.

$ curl -X GET https://ctprods.cyprientaque.com/projects
"Invalid JWT"

información relacionada