#site.conf
<VirtualHost *:80>
ServerName site.ru
ServerAlias www.site.ru
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/frontend/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.site.ru [OR]
RewriteCond %{SERVER_NAME} =site.ru
#делал также RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
#ssl-site.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName site.ru
ServerAlias www.site.ru
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/frontend/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/site.ru/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/site.ru/privkey.pem
</VirtualHost>
</IfModule>
root@site:/etc/apache2/sites-enabled# ls -la
total 8
drwxr-xr-x 2 root root 4096 Mar 20 22:13 .
drwxr-xr-x 8 root root 4096 Mar 20 20:52 ..
lrwxrwxrwx 1 root root 30 Mar 20 21:57 site.conf -> ../sites-available/site.conf
lrwxrwxrwx 1 root root 34 Mar 20 21:57 ssl-site.conf -> ../sites-available/ssl-site.conf