LINUX.ORG.RU
решено ФорумAdmin

Добавление сертификата Let's Encrypt на сервер Apache

 , , , ,


2

1

Установил certbot, получил сертификаты в каталог: /etc/letsencrypt/live/mysite.com/. В конфиге apache /etc/apache2/sites-available/mysite.com.conf добавил следующее:

<VirtualHost mysite.com:443>
ServerName mysite.com:443
ServerAdmin mysite.com@protonmail.com
DocumentRoot /var/www/mysite.com
ServerAlias www.mysite.com:443
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


SSLEngine on
SSLCertificateFile    /etc/letsencrypt/live/mysite.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/mysite.com/fullchain.pem
</VirtualHost>

Перезапустил apache командой sudo systemctl restart apache2. На что получил ошибку

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

При проверке статуса работы командой: sudo systemctl status apache2

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-10-12 14:33:34 EEST; 19s ago
  Process: 11319 ExecStop=/usr/sbin/apachectl stop (code=exited, status=1/FAILURE)
  Process: 10776 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
  Process: 11424 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
 Main PID: 4182 (code=exited, status=0/SUCCESS)

Oct 12 14:33:34 k0t.l.hostens.cloud systemd[1]: Starting The Apache HTTP Server...
Oct 12 14:33:34 k0t.l.hostens.cloud apachectl[11424]: AH00526: Syntax error on line 28 of /etc/apache2/sites-enabled/mysite.com.conf:
Oct 12 14:33:34 k0t.l.hostens.cloud apachectl[11424]: Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
Oct 12 14:33:34 k0t.l.hostens.cloud apachectl[11424]: Action 'start' failed.
Oct 12 14:33:34 k0t.l.hostens.cloud apachectl[11424]: The Apache error log may have more information.
Oct 12 14:33:34 k0t.l.hostens.cloud systemd[1]: apache2.service: Control process exited, code=exited status=1
Oct 12 14:33:34 k0t.l.hostens.cloud systemd[1]: Failed to start The Apache HTTP Server.
Oct 12 14:33:34 k0t.l.hostens.cloud systemd[1]: apache2.service: Unit entered failed state.
Oct 12 14:33:34 k0t.l.hostens.cloud systemd[1]: apache2.service: Failed with result 'exit-code'.

Что я сделал не так и как это сделать правильно?

★★