Falha ao conectar à porta do servidor 443: Conexão recusada

Falha ao conectar à porta do servidor 443: Conexão recusada

Eu tenho um servidor web rodando no meu servidor em 127.0.0.1:8088 e quero acessá-lo pela internet.

Saída de ss -nplut com servidor web em execução:

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

Saída ss -nplut |grep 443

tcp LISTEN 0 511 *:443 *:*

Eu criei um host virtual apache (site habilitado, apache recarregado):

<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>

Criei um certificado SSL com permite criptografar:

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

Eu tenho um registro A em meu provedor de DNS para ctprods.cyprientaque.com apontando para o IP do meu servidor

Mas quando tento acessar meu servidor com curl, recebo um erro:

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

E não consigo ver a solicitação tcpdump porta 443.

Responder1

Seu Apache não está escutando na porta 443. Você configurou seu VirtualHost apenas para HTTP, não para HTTPS. Configure um segundo VirtualHost com porta 443 e seus certificados e certifique-se de ter uma Listen 443diretiva em sua configuração do Apache. Seus certificados não pertencem ao :80VirtualHost.

O texto acima foi baseado em informações erradas na pergunta. O que quer que você tenha feito nesse ínterim, seu servidor agora pode ser recarregado via HTTPS.

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

informação relacionada