add https plugin to wordpress image
Created by: michielbdejong
To install the wordpress wp cli, the setup procedure of the WordPress Dockerfile should run the following as root:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
chmod +x /usr/local/bin/wp
wp --allow-root --info
DB_HOST=172.17.0.5 DB_PORT=3306 DB_NAME=wordpress DB_USER=admin DB_PASS=foo wp --allow-root plugin install wordpress-https
DB_HOST=172.17.0.5 DB_PORT=3306 DB_NAME=wordpress DB_USER=admin DB_PASS=foo wp --allow-root plugin activate wordpress-https
Work-around, on a server that is not live, while using the current wordpress image after you run systemctl start wordpress@domain.com
on your server, do the following:
-
systemctl stop haproxy-confd
-
edit /data/runtime/haproxy/haproxy.cfg, changing the line:
redirect scheme https code 301
to:
use_backend domain.com
If you want to add a wordpress domain to a live server, you will have to do something smarter. :)
- systemctl restart haproxy
- cd /data/domains/domain.com/wordpress/wp-content/
- mkdir plugins
- set the owner and permissions to be the same as for ./uploads, so in my case this was:
- chown 33:33 plugins
- chmod 770 plugins
- visit http://domain.com/wp-login.php?a with your browser (the '?a' will clear the 301 out of the browser cache)
- run the setup wizard if you hadn't already
- log in and go to plugins -> add new -> https
- install "WordPress HTTPS (SSL)" by Mike Ems
- make sure to also activate it! Just installing it does nothing.
- systemctl start haproxy-confd
- cat /data/runtime/haproxy/haproxy.cfg, and make sure the 301 redirect is back in place.