AWS & WordPress ‘wp-config.php’ Settings

So you’re looking to host a WordPress site in AWS using Elastic Beanstalk.

The following lines in your wp-config.php can get you going.

The line below enforces the use of a secure connection for the authentication API. It is off until you define an environment variable in your beanstalk configuration,  called FORCE_SSL_ADMIN with the value ‘true’

define('FORCE_SSL_ADMIN', getenv('FORCE_SSL_ADMIN')==='true');

If you enable secure connections on your Elastic Beanstalk load balancer and find that you keep getting redirected the line below indicates allows WP to detect that HTTPS is being used.

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)

These settings are defined as environment variables so you  don’t have to hardcode them in wp-config.php.

define('DB_NAME', getenv('RDS_DB_NAME'));
define('DB_USER', getenv('RDS_USERNAME'));
define('DB_HOST', getenv('RDS_HOST'));