Не удалось подключиться к порту сервера 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 *:*

Я создал виртуальный хост Apache (сайт включен, Apache перезагружен):

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

Я создал SSL-сертификат с помощью 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

У меня есть запись A в DNS-сервере моего провайдера для ctprods.cyprientaque.com, указывающая на IP-адрес моего сервера.

Но когда я пытаюсь получить доступ к своему серверу с помощью curl, я получаю ошибку:

$ 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 только для HTTP, а не для HTTPS. Настройте второй VirtualHost с портом 443 и вашими сертификатами и убедитесь, что у вас есть директива Listen 443в конфигурации Apache. Ваши сертификаты не относятся к :80VirtualHost.

Вышеизложенное было основано на неверной информации в вопросе. Что бы вы ни делали в это время, ваш сервер теперь доступен через HTTPS.

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

Связанный контент