I had a very specific problem that i wanted to solve: setting up a wordpress installation that had https, and it had to be inside of a docker container. wew, tall order!
VERY luckily for me, the project HTTPS-PORTAL is is working order and being actively developed!
Using Let's Encrypt'scertificate automation, I was able to set up an HTTPS wordpress install in under five minutes. Here are some reasons why sites should be using HTTPS:
- HTTPS helps prevent intruders from tampering with the communications between your websites and your users’ browsers. Intruders include intentionally malicious attackers, and legitimate but intrusive companies, such as ISPs or hotels that inject ads into pages.
- HTTPS prevents intruders from being able to passively listen in on the communications between your websites and your users.
- It is much cheaper and faster to imlement because of the Let's Encrypt project!
I followed this tutorial to get me up and running with my wordpress install. I had some problems understanding how to write a docker-compose file, but the blog author was very quick assisting to correct my mistakes.
Here is what my docker-compose.yml file contained, minus the real password:
# docker-compose.yml for my_wordpress site
https-portal:
image: steveltn/https-portal
ports:
- 80:80
- 443:443
links:
- wordpress
environment:
- "DOMAINS=containerize.us -> http://wordpress" #maps https-portal to the wordpress image
- "PRODUCTION=true" #ensures that the certificate will be recognized as valid by web browsers
wordpress:
image: wordpress
links:
- db:mysql
db:
image: mariadb
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: <secure_password>
After waiting for awhile while the computer produces spins up the HTTPS WordPress instance, we have WordPress installed! Yay!
Now let's insert some media. I can upload the small hamster photo just fine, but this picture of a cat is too large for WordPress's 2MB default media limit. We can change this.
To enter the container, type:
docker exec -i -t mywordpress_wordpress_1 bash
To install the nano text editor, type:
apt-get update
apt-get install vim
Create the file php.ini in you WordPress root directory
vi php.ini
Once in, paste these lines:
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 64M
Stop the running containers
docker stop mywordpress_db_1 mywordpress_https-portal_1 mywordpress_wordpress_1
In the directory you put docker-compose.yml, run:u
docker-compose up -d
Hurray, our upload limit is now increased! Let's get that cat photo onto our website.
(didn't work photo)
Oh no, the cryptic WordPress HTTP error. How sad. This may be due to the new wordpress upgrade to 4.5, idk. Search results show that this is a very common issue. One possible solution is to optimize your picures for the web.
This issue is currently being fixed. View progress here