[www] Wordpress (Do...
 
Notifications
Clear all

[www] Wordpress (Docker)

1 Posts
1 Users
0 Reactions
32 Views
(@andre)
Posts: 51
Member Admin
Topic starter
 
upload_max_filesize = 20M
post_max_size = 20M
memory_limit = 20M
upload_max_filesize = 20M
post_max_size = 20M
memory_limit = 20M

Install

Create a Folder

mkdir your-website-name
cd your-website-name
nano docker-compose.yml

Docker Compose

services:
  db:
    # We use a mariadb image which supports both amd64 & arm64 architecture
    image: mariadb:10.6.4-focal
    # If you really want to use MySQL, uncomment the following line
    #image: mysql:8.0.27
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - db_data:/var/lib/mysql
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD={YourSecurePassword}
      - MYSQL_DATABASE=wordpress
      - MYSQL_USER=wordpress
      - MYSQL_PASSWORD=wordpress
    expose:
      - 3306
      - 33060
  wordpress:
    image: wordpress:latest
    volumes:
      - wp_data:/var/www/html
    ports:
      - 32270:80
    restart: always
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=wordpress
      - WORDPRESS_DB_PASSWORD=wordpress
      - WORDPRESS_DB_NAME=wordpress
volumes:
  db_data:
  wp_data:

Publish 

docker-compose up -d

 

HTTPS

Enable these settings on your Reverse Proxy

Force SSL
HTTP/2 Support

or edit the wp-config.php

docker exec -it your-website-name-wordpress-1 sh
apt update
apt install nano
nano wp-config.php

Replace the section 

// If we're behind a proxy server and using HTTPS, we need to alert WordPress of that fact
// see also  https://wordpress.org/support/article/administration-over-ssl/#using-a-reverse-proxy 
//if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
//        $_SERVER['HTTPS'] = 'on';
//}
// (we include this by default because reverse proxying is extremely common in container environments)

$_SERVER['HTTPS'] = 'on';

SiteUrl

define('WP_HOME','https://valleycommunity.co.za');
define('WP_SITEURL','https://valleycommunity.co.za');

 

Upload Size

add php.ini

upload_max_filesize = 20M
post_max_size = 20M
memory_limit = 20M
This topic was modified 2 weeks ago 2 times by Andre Tiltman
 
Posted : 02/10/2024 1:04 pm
Share: