Generate letsencrypt ssl certificate without certbot. Apache

15. aprīlis, 2020
Bash
/etc/apache2/sites-enabled/webit.lv.conf
<VirtualHost *:80>
    ServerName webit.lv
    ServerAlias www.webit.lv

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =webit.lv [OR]
    RewriteCond %{SERVER_NAME} =www.webit.lv
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Bash
/etc/apache2/sites-enabled/webit.lv-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLEngine on

    ServerName webit.lv
    ServerAlias www.webit.lv

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.webit.lv
    RewriteRule ^ https://webit.lv%{REQUEST_URI} [END,NE,R=permanent]

    DocumentRoot /var/www/webit.lv

    <Directory "/var/www/webit.lv">
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.webit.log
    CustomLog ${APACHE_LOG_DIR}/access.webit.log combined

    SSLCertificateFile "/var/certs/webit.lv/certificate.crt"
    SSLCertificateKeyFile "/var/certs/webit.lv/private.key"
</VirtualHost>
</IfModule>