Ошибка Apache HTTPS Certbot LetsEncrypt

Я пытаюсь настроить веб-сайт с HTTPS на сервере Linode. Он работает по HTTP, но не по HTTPS.

Я попытался использовать Certbot для настройки своего домена для HTTPS.

root@mailer9:/etc/apache2/sites-enabled# sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: mailer9.com
2: www.mailer9.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 
Attempting to parse the version 0.29.1 renewal configuration file found at /etc/letsencrypt/renewal/mailer9.com.conf with version 0.28.0 of Certbot. This might not work.
Cert not yet due for renewal

You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/mailer9.com.conf)

What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for mailer9.com
http-01 challenge for www.mailer9.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/apache2/sites-enabled/mailer9.com-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-enabled/mailer9.com-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Your existing certificate has been successfully renewed, and the new certificate
has been installed.

The new certificate covers the following domains: https://mailer9.com and
https://www.mailer9.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=mailer9.com
https://www.ssllabs.com/ssltest/analyze.html?d=www.mailer9.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/mailer9.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/mailer9.com/privkey.pem
   Your cert will expire on 2019-04-02. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

root@mailer9:/etc/apache2/sites-enabled# 

Он говорит, что все должно работать нормально, но не работает в режиме HTTPS.

Я вижу два файла VH в каталоге с поддержкой сайтов.

root@mailer9:/etc/apache2/sites-enabled# cat mailer9.com.conf 
# domain: mailer9.com
# public: /var/www/html/mailer9.com/public_html/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin [email protected]
  ServerName  mailer9.com
  ServerAlias www.mailer9.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/mailer9.com/public_html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/mailer9.com/log/error.log
  CustomLog /var/www/html/mailer9.com/log/access.log combined

#RewriteEngine on
#RewriteCond %{SERVER_NAME} =mailer9.com [OR]
#RewriteCond %{SERVER_NAME} =www.mailer9.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Еще один для HTTPS, автоматически сгенерированный Certbot.

root@mailer9:/etc/apache2/sites-enabled# cat mailer9.com-le-ssl.conf 
<IfModule mod_ssl.c>
<VirtualHost *:443>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin [email protected]
  ServerName  mailer9.com
  ServerAlias www.mailer9.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/mailer9.com/public_html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/mailer9.com/log/error.log
  CustomLog /var/www/html/mailer9.com/log/access.log combined


SSLEngine on
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/mailer9.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mailer9.com/privkey.pem
</VirtualHost>
</IfModule>
root@mailer9:/etc/apache2/sites-enabled# 

Однако, если я захожу на http://mailer9.com/, все работает нормально. Но если я перехожу на https://mailer9.com/, страница не загружается. Я понятия не имею, как это решить, все выглядит хорошо для меня.

Команда модулей Apache apachectl -M показывает, что ssl_module загружен.


person Pankaj    schedule 02.01.2019    source источник
comment
Строка ErrorLog /var/www/html/mailer9.com/log/error.log означает, что сообщения об ошибках будут сохраняться в /var/www/html/mailer9.com/log/error.log. Это первое место, на которое нужно смотреть.   -  person Álvaro González    schedule 02.01.2019


Ответы (1)


Это было вызвано из-за брандмауэра ufw. Я добавил порт 443, и это исправлено.

sudo ufw allow 443/tcp
person Pankaj    schedule 02.01.2019