diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index be6af5c008..5c34d61efe 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -25,7 +25,7 @@ fi if ! [ -e index.php -a -e wp-includes/version.php ]; then echo >&2 "WordPress not found in $(pwd) - copying now..." - rsync --archive --one-file-system --quiet /usr/src/wordpress/ ./ + rsync --archive --one-file-system --quiet --exclude='*.sh' --exclude='*.conf' --exclude='Dockerfile' /usr/src/wordpress/ ./ echo >&2 "Complete! WordPress has been successfully copied to $(pwd)" if [ ! -e .htaccess ]; then cat > .htaccess <<-'EOF' @@ -43,6 +43,14 @@ fi if [ ! -e wp-config.php ]; then cp wp-config-sample.php wp-config.php + cat >> wp-config.php <<'EOPHP' + +// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact +// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy +if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { + $_SERVER['HTTPS'] = 'on'; +} +EOPHP fi set_config() {