WordPress

From Leo's Notes
Last edited on 15 June 2020, at 00:00.

Docker Image

Getting a new installation of WordPress with the official docker image is trivial.

wordpress:
    image: wordpress:5-php7.3-apache
    labels:
      - "traefik.enable=true"
      - "traefik.port=80"
      - "traefik.docker.network=traefik"
      - "traefik.web.frontend.rule=Host:wordpress.local"
    depends_on:
      - db
    networks:
      - traefik
      - db-net
    expose:
      - "8080"
    restart: always
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=wordpress
      - WORDPRESS_DB_PASSWORD=wordpress
      - WORDPRESS_DB_DB_NAME=wordpress
    volumes:
      - /var/volumes/local-web/data/wordpress:/var/www/html

The WordPress image will only install and re-configure the wp-config.php file using environment variables. It will not update WordPress for you, though this isn't an issue since WordPress can self-update.

To allow plugins and theme installs without FTP, change FS_METHOD to direct and ensure that the wp-content directory is owned by www-data or uid 82.

## Add to wp-content.php
## define('FS_METHOD', 'direct');

/var/www/html# chown -R www-data wp-content