서버 포트 443에 연결하지 못했습니다: 연결이 거부되었습니다.

서버 포트 443에 연결하지 못했습니다: 연결이 거부되었습니다.

내 서버에서 127.0.0.1:8088의 웹 서버가 실행되고 있으며 인터넷에서 해당 서버에 액세스하고 싶습니다.

웹 서버 실행 시 ss -nplut 출력:

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

출력 ss -nplut |grep 443

tcp LISTEN 0 511 *:443 *:*

아파치 가상 호스트를 만들었습니다(사이트 활성화, 아파치가 다시 로드됨).

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

Let encrypt를 사용하여 SSL 인증서를 만들었습니다.

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

내 서버 IP를 가리키는 ctprods.cyprientaque.com의 DNS 공급자에 A 레코드가 있습니다.

하지만 컬을 사용하여 서버에 액세스하려고 하면 오류가 발생합니다.

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

그리고 요청 tcpdump 포트 443을 볼 수 없습니다.

답변1

Apache가 포트 443에서 수신 대기하지 않습니다. VirtualHost를 HTTPS가 아닌 HTTP용으로만 구성했습니다. 포트 443과 인증서로 두 번째 VirtualHost를 구성하고 Listen 443Apache 구성에 지시문이 있는지 확인하십시오. 귀하의 인증서는 VirtualHost에 속하지 않습니다 :80.

위의 내용은 질문의 잘못된 정보를 바탕으로 작성되었습니다. 그동안 무엇을 했는지 이제 HTTPS를 통해 서버에 다시 연결할 수 있습니다.

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

관련 정보