Setting up WordPress in an LXC container behind haproxy on a home network

Last night I followed the directions posted by http://rangersdesk.top/wordpress/ and, after – what are for me fairly standard stumbles – generally following the recipe, I had a fresh new up-to-date, but empty, Wordperfect site ready to go in about 4-5 hours. I’d like to try it again sometime soon but using an Alpine base for the LXC container. Maybe it will go quicker now that I’ve already explored lots of pitfalls.

One thing I did was this code snippet

define('WP_HOME','http://YourDomain.com');
define('WP_SITEURL','http://YourDomain.com');

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
    define('WP_HOME','https://YourDomain.com');
    define('WP_SITEURL','https://YourDomain.com');
    $_SERVER['HTTPS'] = 'on';
}

The purpose of that snippet is to cause WordPress to behave the same way when it is being accessed from inside my home network versus accessed through the external internet – where everything has to pass through an haproxy host.

Note to self:

I wanted to have the code block appear in a monospace font, perhaps even with syntax highlighting for language-php. I found the plugin called Code Block Pro gives me what I wanted.

The other thing I was wanting to figure out is how to integrate Markdown with WordPress. One of my other experimental sites consists entirely of Markdown content. I find Markdown is somewhat easier than Gutenberg for writing slightly styled text with little fuss.

The new site I created is named – and intended to be used – for my Braver Angels activities.

Leave a Comment

WordPress Appliance - Powered by TurnKey Linux