Daanra/laravel-lets-encrypt

Notworking ssl

Closed this issue · 2 comments

I do all the operations as you describe. I see that it is saved in the key files. But ssl does not work. I don't understand, do I need to make a setting on the apache side?
By the way, I could not access the following classes in the library.
new CreateNewApacheVirtualHost('mydomain.com'),
new ReloadApache(),
new NotifyUserOfNewCertificate(request()->user()),

But ssl does not work.

This library will give you a valid SSL certificate. You are responsible yourself for integrating this SSL certificate within your web server.

By the way, I could not access the following classes in the library.

These classes do not exist, they were just used as an example. You could implement them yourself.

If you are using Apache2, then after generating the SSL certificate you could create a virtual host at /etc/apache2/sites-available/{$domain}.conf, with the following contents:

<VirtualHost *:80>
        ServerName $domain
        ServerAlias www.$domain
        Redirect permanent / https://$domain/
        ServerAdmin test@test.test
        DocumentRoot /var/www/html/current/public

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
        ServerName $domain
        ServerAlias www.$domain

        ServerAdmin test@test.test
        DocumentRoot /var/www/html/current/public

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

        SSLEngine on
        # Here, you have to point the SSLCertificates to where they're stored on disk. If your root application directory is '/var/www/html', then they should be stored here:
        SSLCertificateFile /var/www/html/storage/app/letsencrypt/certificates/$domain/fullchain.pem
        SSLCertificateKeyFile /var/www/html/storage/app/letsencrypt/certificates/$domain/privkey.pem
</VirtualHost>

You have to change this .conf file to point to the appropriate SSL certificates and you have to replace $domain with the domain name for which you generated the SSL certificates.
Next, you have to enable this virtual host with: a2ensite $domain
and then you would have to reload apache to have the changes take effect: systemctl reload apache2

ok thanks my probably problem is in my apache settings