Thomas Cuthbert has proposed merging ~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master.
Requested reviews: Wordpress Charmers (wordpress-charmers) For more details, see: https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder/+merge/382824 -- Your team Wordpress Charmers is requested to review the proposed merge of ~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master.
diff --git a/Dockerfile b/Dockerfile index 2c86bef..706ea9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,8 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio # Update all packages, remove cruft, install required packages, configure apache RUN apt-get update && apt-get -y dist-upgrade \ && apt-get --purge autoremove -y \ - && apt-get install -y apache2 curl libapache2-mod-php php php-gd php-mysql \ - php-symfony-yaml pwgen python3 python3-yaml ssl-cert \ + && apt-get install -y apache2 curl libapache2-mod-php php php-gd php-xml php-mysql php7.2-curl php7.2-gmp \ + php-symfony-yaml pwgen python3 python3-yaml ssl-cert libgmp-dev \ && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \ && . "$APACHE_ENVVARS" \ && for dir in "$APACHE_LOCK_DIR" "$APACHE_RUN_DIR" "$APACHE_LOG_DIR"; do rm -rvf "$dir"; mkdir -p "$dir"; chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; chmod 777 "$dir"; done \ @@ -33,7 +33,8 @@ RUN apt-get update && apt-get -y dist-upgrade \ COPY ./files/docker-php.conf $APACHE_CONFDIR/conf-available/docker-php.conf RUN a2enconf docker-php \ && a2dismod mpm_event \ - && a2enmod mpm_prefork + && a2enmod mpm_prefork \ + && a2enmod rewrite # Install the main Wordpress code, this will be our only site so /var/www/html is fine RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/latest.tar.gz" \ diff --git a/files/docker-php.conf b/files/docker-php.conf index af22747..283d871 100644 --- a/files/docker-php.conf +++ b/files/docker-php.conf @@ -8,4 +8,10 @@ DirectoryIndex index.php index.html <Directory /var/www/> Options -Indexes AllowOverride All + RewriteEngine On + RewriteBase / + RewriteRule ^index\.php$ - [L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.php [L] </Directory> diff --git a/files/wp-config.php b/files/wp-config.php index 7b9a387..b0c05e9 100644 --- a/files/wp-config.php +++ b/files/wp-config.php @@ -12,6 +12,20 @@ /* That's all, stop editing! Happy blogging. */ +/** Enable container debug level logging. **/ +if ( getenv("WORDPRESS_DEBUG") ) { + define( 'WP_DEBUG', true ); + define('WP_DEBUG_DISPLAY', false); + define( 'WP_DEBUG_LOG', '/dev/stderr' ); +} + +/** Fixes for mixed content when WordPress is behind nginx TLS reverse proxy. + * https://ahenriksson.com/2020/01/27/how-to-set-up-wordpress-behind-a-reverse-proxy-when-using-nginx/ + * */ +define('FORCE_SSL_ADMIN', true); +if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') + $_SERVER['HTTPS']='on'; + /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); @@ -32,8 +46,8 @@ define( 'WP_HTTP_BLOCK_EXTERNAL', true ); define( 'AUTOMATIC_UPDATER_DISABLED', true ); define( 'WP_AUTO_UPDATE_CORE', false ); -/** Enable container debug level logging. **/ -if ( getenv("WORDPRESS_DEBUG") ) - define( 'WP_DEBUG', true ); +$http_host = $_SERVER['HTTP_HOST']; +define('WP_HOME',"https://$http_host"); +define('WP_SITEURL',"https://$http_host"); remove_filter('template_redirect', 'redirect_canonical');
-- Mailing list: https://launchpad.net/~wordpress-charmers Post to : wordpress-charmers@lists.launchpad.net Unsubscribe : https://launchpad.net/~wordpress-charmers More help : https://help.launchpad.net/ListHelp