Magento2 – Fix Static Files Not Loading After Enabling HTTPS

magento2ssl

I set Secure Base URL to https://magento22.local , did setup:upgrade
settings
But now it tries to load all static content through http and chrome gives error "mixed content", so no styles or script are loaded.

result
I tried clearing everything – cache, static files folder, reloading server, enabling production mode – nothing helps.

What's the problem? Why Magento doesn't use HTTPS URLs?

"Use Secure URLs on Storefront" setting doesn't change anything

Best Answer

Did you install ssl for localhost server?

Try to add it:

sudo nano /etc/apache2/apache2.conf

Modify section:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

to this

<Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

After that, run command

sudo a2enmod ssl

sudo a2ensite default-ssl

sudo a2enmod rewrite

sudo service apache2 restart
Related Topic