• Resolved bassphil

    (@bassphil)


    Hi all. I’ll first throw out the short version. Let me know if you need more info and I’ll post the long version. Just so you know. I am using Amazon Web Services (AWS) for this. So, here’s what I need to happen:

    I want to tell my DNS zone to point all traffic for write.mysite.com to an IP address for a server that is hosting a WP installation. The database for that is hosted on a separate RDS server.

    Then I want to create another record in my DNS zone to point all traffic for mysite.com to the address of a load balancer that is overtop of a few servers that are mirrored copies of my WP installation. They are all reading from the same RDS database installation. (They are pulling the WP code down from an S3 bucket. That’s how they stay mirrored).

    Is this a possible thing to accomplish? So far it seems like I can either have the primary server that I write to or one of the servers behind the load balancer, but not a divided traffic pattern because WP keeps redirecting traffic to whatever URL is in the database.

    Is there a way to adjust (or hack) WP to accomplish this? Thanks for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bassphil

    (@bassphil)

    Nobody? Well, in the meantime, I figured it out. There are quite a few hoops to jump though, but it is possible. I’ll post again as soon as I am sure that it works properly.

    Thread Starter bassphil

    (@bassphil)

    Okay, it is working properly. Here is the secret.

    The issue is the WordPress database. It always stores absolute file path URLS. All traffic is directed to the main URL, which in this case, is actually pointing to all of the (what I am calling) read-node servers behind the load balancer.

    So, to fix this you have to install a WordPress plug that will strip the absolute file paths from the database thus leaving everything with a relative path. There are plugins out there that seem to strip the absolute file paths for the browser side of things but not IN the database itself, so be aware of that. I used a plugin called “Make Paths Relative” by Yas Global that indeed alters the database URLs.

    Next, I added this bit of code to the wp-config.php file:

    define(‘WP_HOME’, ‘https://’.$_SERVER[‘HTTP_HOST’].’/’);

    define(‘WP_SITEURL’, ‘https://’.$_SERVER[‘HTTP_HOST’].’/’)

    NOW you can have admin.yoursite.com point to a specific server and yoursite.com point to another server or load balancer that all share the same WordPress installation as noted above without having to resort to AWS EFS (if you’re trying to save money).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is this even possible? Make WP point wp-admin traffic to a specific IP?’ is closed to new replies.