Wordpress broken on Lightsail distribution CentOS / Server is multi host

0

It seems that there's nothing on the Internet that I can find about this. Everyone is either saying use the Wordpress Lightsail instance, or Amazon Linux.. I am in the middle of migrating my server from another hosting company to Lightsail because I love AWS and I saw Lightsail is much cheaper and integrates with CloudFront, etc. all that good stuff.

So I created an instance with CentOS OS only, installed everything I need-- Apache, MySQL, etc. and I migrated Wordpress over from the other server. Moved the database over, created a user, fixed the wp-config.php etc. etc. the way you'd migrate WP to another server.

I have DNS working for the domain, and I configured a distribution and created a certificate and the distribution is pulling HTTP only. The original WP had SSL so I changed the siteurl and sitehome in the DB to be http and not https as they were on the old setup.

When I go to the site both frontend and backend (wp-admin) it has no CSS and looks horrid and just is all kinds of broken with hundreds of insecure content errors accumilating in the js console which are from wp-includes/js/......

I tried where it said to put the code in the wp-config.php for SSL termination which is this code here:

define('WP_SITEURL', 'https://' . $_SERVER\['HTTP_HOST'] . '/');
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/');

if (isset($_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'])
&& $_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}

  
But it doesn't fix the site.. It just makes things a tiny bit better but there's still a ton of broken CSS and the whole thing is broken.   
  
I'm not using the really simple ssl plugin or anything I checked.. So I have no idea what is going on.  
  
but I wanted CentOS because I'm RHEL and I wanted to stick with stock CentOS and I have other websites and uses for that server I'm not just running wordpress on it.. In fact I hate WP so this is the only WP site on here. but I have migrated dozens of wordpress sites and never had issues. I'm stumped here.  
  
Please help. Thx.  
  
Edited by: Alex on May 21, 2021 6:34 PM  
  
Edited by: Alex on May 21, 2021 6:37 PM
Alex
asked 3 years ago455 views
2 Answers
0

Ok so the answer to my problem is specified on this Stack Overflow page:

https://stackoverflow.com/questions/55024367/cloudfront-ssl-issue-on-wordpress-too-many-redirects

I post that because I couldn't for the life of me figure out how the markdown works on these forums to post code. It keeps on posting some links for some reason but doesn't recognize backticks for posting code.

Anyhow, the lines specified need to be put above the "require_once ABS_PATH . 'wp-settings.php';" line..

As for the WPSITE and WPHOME things they are originally set to https in the database so I don't need to put them in wp-config.php ..

Funny all I did was move that and it works perfectly. :) I'm just psoting this here for anyone else who might have this problem.

Alex
answered 3 years ago
0

Ok so the answer to my problem is specified on this Stack Overflow page:

https://stackoverflow.com/questions/55024367/cloudfront-ssl-issue-on-wordpress-too-many-redirects

I post that because I couldn't for the life of me figure out how the markdown works on these forums to post code. It keeps on posting some links for some reason but doesn't recognize backticks for posting code.

Anyhow, the lines specified need to be put above the "require_once ABS_PATH . 'wp-settings.php';" line..

As for the WPSITE and WPHOME things they are originally set to https in the database so I don't need to put them in wp-config.php ..

Funny all I did was move that and it works perfectly. :) I'm just psoting this here for anyone else who might have this problem.

Alex
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions