Skip to content

Instantly share code, notes, and snippets.

@slogsdon
Last active April 14, 2024 19:07
Show Gist options
  • Select an option

  • Save slogsdon/c0f6736f45f578e9e32f to your computer and use it in GitHub Desktop.

Select an option

Save slogsdon/c0f6736f45f578e9e32f to your computer and use it in GitHub Desktop.

Revisions

  1. slogsdon revised this gist May 30, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions wp-config.php
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,9 @@

    // Redis settings
    // only need to override the default host
    //
    // Works with https://wordpress.org/plugins/redis-cache/,
    // not sure about others/
    define('WP_REDIS_HOST', 'redis');

    // Use your keys/salts
  2. slogsdon created this gist May 30, 2015.
    4 changes: 4 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # Basic setup to copy Wordpress files,
    # expected to be at '.', into the image
    FROM orchardup/php5
    ADD . /code
    38 changes: 38 additions & 0 deletions docker-composer.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    # Main container hosting Wordpress
    #
    # Can be scaled with `docker-compose scale web=n`
    # to spawn `n` Wordpress nodes. A restart
    # (`docker-compose restart`) may be required for
    # scaled nodes to be added to the HAProxy
    # node's configuration.
    web:
    build: .
    command: php -S 0.0.0.0:8000 -t /code
    expose:
    - 8000
    links:
    - db
    - redis
    volumes:
    - .:/code

    # HAProxy container
    haproxy:
    image: tutum/haproxy
    ports:
    - "8000:80"
    - "443:443"
    links:
    - web
    environment:
    BACKEND_PORT: 8000

    # MySQL container
    db:
    image: orchardup/mysql
    environment:
    MYSQL_DATABASE: wordpress

    # Redis container
    redis:
    image: redis
    19 changes: 19 additions & 0 deletions router.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <?php

    // Allows Wordpress permalinks to work
    // behind the built-in PHP HTTP server

    $root = $_SERVER['DOCUMENT_ROOT'];
    chdir($root);
    $path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
    set_include_path(get_include_path().':'.__DIR__);
    if(file_exists($root.$path))
    {
    if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
    $path = rtrim($path,'/').'/index.php';
    if(strpos($path,'.php') === false) return false;
    else {
    chdir(dirname($root.$path));
    require_once $root.$path;
    }
    }else include_once 'index.php';
    31 changes: 31 additions & 0 deletions wp-config.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <?php

    // MariaDB settings
    define('DB_NAME', 'wordpress');
    define('DB_USER', 'root');
    define('DB_PASSWORD', '');
    define('DB_HOST', "db:3306");
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
    $table_prefix = 'wp_';

    // Redis settings
    // only need to override the default host
    define('WP_REDIS_HOST', 'redis');

    // Use your keys/salts
    define('AUTH_KEY', '...');
    define('SECURE_AUTH_KEY', '...');
    define('LOGGED_IN_KEY', '...');
    define('NONCE_KEY', '...');
    define('AUTH_SALT', '...');
    define('SECURE_AUTH_SALT', '...');
    define('LOGGED_IN_SALT', '...');
    define('NONCE_SALT', '...');

    define('WP_DEBUG', false);

    if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

    require_once(ABSPATH . 'wp-settings.php');