I have two Docker containers (WordPress and MySQL) and I installed Apache on the server.
So it looks something like this;
I am trying to add an SSL certificate to it with Certbot.
So far, my Apache configuration file is this;
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyPass / http://localhost:4567/
ProxyPassReverse / http://localhost:4567/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
And I have added this two lines of code to wp-config.php;
define('WP_HOME', 'http://example.com/');
define('WP_SITEURL', 'http://example.com/');
When I use certbot --apache
and choose the domain to add the SSL certificate, the website "brakes"; no CSS, no JS, no images and I can’t access to the admin (to try to change http to https using Search and Replace);
I tried to change http with https and add define('FORCE_SSL_ADMIN', true);
to wp-config.php but that didn’t work;
Do anyone know the perfect way to add an SSL to Dockerized wordpress container?
PS: I tried a desperate move to change manually all the http://example.com to https://example.com in all tables in the database. it didn’t work and it is a pretty stupid thing to do, but desperate times call for desperate measures.
2
Answers
This needs to be https, otherwise your assets will load from http resulting in mixed content.
This is the apache config file from bitnami images, maybe this helps: