Verbindung zum Server-Port 443 konnte nicht hergestellt werden: Verbindung abgelehnt

Verbindung zum Server-Port 443 konnte nicht hergestellt werden: Verbindung abgelehnt

Auf meinem Server unter 127.0.0.1:8088 läuft ein Webserver, auf den ich über das Internet zugreifen möchte.

Ausgabe von ss -nplut bei laufendem Webserver:

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

Ausgabe ss -nplut |grep 443

tcp LISTEN 0 511 *:443 *:*

Ich habe einen virtuellen Apache-Host erstellt (Site aktiviert, Apache neu geladen):

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

Ich habe mit Lets Encrypt ein SSL-Zertifikat erstellt:

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

Ich habe einen A-Eintrag in meinem DNS-Provider für ctprods.cyprientaque.com, der auf meine Server-IP verweist

Aber wenn ich versuche, mit Curl auf meinen Server zuzugreifen, erhalte ich eine Fehlermeldung:

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

Und ich kann die TCPdump-Anforderung für Port 443 nicht sehen.

Antwort1

Ihr Apache hört nicht auf Port 443. Sie haben Ihren VirtualHost nur für HTTP konfiguriert, nicht für HTTPS. Konfigurieren Sie einen zweiten VirtualHost mit Port 443 und Ihren Zertifikaten und stellen Sie sicher, dass Sie eine Listen 443entsprechende Anweisung in Ihrer Apache-Konfiguration haben. Ihre Zertifikate gehören nicht in den :80VirtualHost.

Das Obige basierte auf falschen Informationen in der Frage. Was auch immer Sie in der Zwischenzeit getan haben, Ihr Server ist jetzt über HTTPS erreichbar.

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

verwandte Informationen