Using Wordpress CMS on AWS Elastic Beanstalk - Trouble deploying (page doesn't load) Using Wordpress CMS on AWS Elastic Beanstalk - Trouble deploying (page doesn't load) wordpress wordpress

Using Wordpress CMS on AWS Elastic Beanstalk - Trouble deploying (page doesn't load)


Figured it out. Turns out I just wasn't accounting for a few variables that WP sets as you install WP - the URL's associated with the installation. So in this case, WP was pointing to my localhost links, even when I deployed to the server.

The straightforward fix is to go to WordPress, Settings > General, and change both the Wordpress Address and Site Address URLs to reflect the server URL rather than your local URL. You should do this right before you deploy, because after you change it you'll no longer be able to access it via localhost.

The more complete fix is to set up your wp-config.php file to account for this. Those two fields correspond to WP_HOME and WP_SITEURL variables. For my setup (in which I used git branching to differentiate between development and production code), I used this:

// Check for a local config fileif ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {   define( 'WP_LOCAL_DEV', true );   include( dirname( __FILE__ ) . '/local-config.php' );} else {  define( 'WP_LOCAL_DEV', false );  define('WP_HOME','http://myserverurl.com');  define('WP_SITEURL','http://myserverurl.com');}

In local-config.php, I just had:

<?php define('WP_HOME','http://localhost:8888'); define('WP_SITEURL','http://localhost:8888'); ?>

I listed local-config.php in .gitignore, which meant whenever I deployed, local-config.php was not included, and the right variables were used when trying to run on the server.