apiVersion: v1
kind: ConfigMap
metadata:
  name: wordpress
  labels:
    app: wordpress
data:
  wp-config.php: |
    <?php
    /**
     * The base configuration for WordPress
     *
     * The wp-config.php creation script uses this file during the
     * installation. You don't have to use the web site, you can
     * copy this file to "wp-config.php" and fill in the values.
     *
     * This file contains the following configurations:
     *
     * * MySQL settings
     * * Secret keys
     * * Database table prefix
     * * ABSPATH
     *
     * @link https://codex.wordpress.org/Editing_wp-config.php
     *
     * @package WordPress
     */
    
    #define('WP_ALLOW_REPAIR', true);
    define('FS_METHOD', 'direct');
    
    define('DB_FILE', 'db.db');
    define('DB_DIR', '/var/www/db/');
    
    /** Database Charset to use in creating database tables. */
    #define('DB_CHARSET', 'utf8mb4');
    define('DB_CHARSET', 'utf8');
    
    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each
     * a unique prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix  = 'wp_';
    
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     *
     * For information on other constants that can be used for debugging,
     * visit the Codex.
     *
     * @link https://codex.wordpress.org/Debugging_in_WordPress
     */
    define('WP_DEBUG', false);
    
    define('DISALLOW_FILE_EDIT', true);
    
    /* That's all, stop editing! Happy blogging. */
    
    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
        define('ABSPATH', dirname(__FILE__) . '/');
    
    // Reverse proxy https fix
    if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
        $_SERVER['HTTPS'] = 'on';
    if (isset($_SERVER['HTTP_X_FORWARDED_HOST']))
        $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
    
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');
    
  default.conf: |
    server {
      listen       80;
      server_name  localhost;
      root   /var/www/html;

      location / {
          index  index.php;
          try_files $uri $uri/ /index.php?$args;
      }

      #error_page  404              /404.html;

      # redirect server error pages to the static page /50x.html
      #
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   /usr/share/nginx/html;
      }

      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
      #
      location ~ \.php$ {
          #root           html;
          fastcgi_pass   127.0.0.1:9000;
          fastcgi_index  index.php;
          fastcgi_param  SCRIPT_FILENAME  /var/www/html/$fastcgi_script_name;
          include        fastcgi_params;
      }

      location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
          expires max;
      }

      location = /robots.txt {
          allow all;
      }

      # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
      # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
      location ~ /\. {
          deny all;
      }

      # Deny access to any files with a .php extension in the uploads directory
      # Works in sub-directory installs and also in multisite network
      # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
      location ~* /(?:uploads|files)/.*\.php$ {
          deny all;
      }
    }
