HTTPS

Well, that was easy!  Lets Encrypt is pretty awesome, and just setup some permanent redirects along with HSTS.

New Hosting

Well, as my Azure credits will surely run out sometime soon from my MSDN account, I needed to find new hosting.  After a lot of searching for the right place, my new home is at TMD Hosting.

I didn’t want a full host to manage, and reading the reviews these are some of the best.  The import took a bit longer than anticipated (issues with the Softaculous script), but so far so good!

Next steps are to enable HTTPS via Lets Encrypt.

Nginx + WordPress + Infinite Redirects

As I was migrating my websites to a new host (I may blog about that later as it’s been an interesting ride), I had this lovely issue where one of my websites would go into an infinite redirect loop when sitting behind the Azure CDN (custom origin).

Of course, it worked fine for all pages except for the root.  And it also worked fine when it wasn’t behind the Azure CDN.  For whatever reason, adding a bit of code to the functions.php theme seemed to work.

remove_filter('template_redirect', 'redirect_canonical');

I then had to add in a manual redirect in nginx via the below.  Still no idea why it doesn’t just “work” as it has before, but whatever. Now that it’s working, I should go back and figure out why it wasn’t with redirect_canonical…

server {
   listen 80;
   server_name test.com;
   rewrite ^ $scheme://www.test.com$request_uri? permanent;
}

Sender Policy Framework (SPF) Records

With the move of my domains to Azure instead of Dreamhost (oh, did I not mention that?), one of the things I needed to do was setup some SPF records to keep email from going into junk folders.

Now, there is a great article on creating SPF records, but those that know me know I’m not a big reader when there is a lot of text.  Pictures FTW!

Anyways, as MS is a big proponent of utilizing SPF, they have created an excellent tool to create the record’s text.  Yay team!

Migration to WordPress Network Part 3

I haven’t talked about this in awhile, but everything has been running smoothly. Having only two instances I need to worry about is definitely better than the 5+.

However, today, I wanted to add a subdomain to a domain that is hosted in the WordPress Network. It took a few minutes to remember what I had done (thankfully all the articles I already read helped), but a few minutes later I had a subdomain running.

Essentially it is the same setup as before:

  1. Create the website in the WordPress Network Admin site (i.e. subdomainA.rebelpeon.com)
  2. Create the subdomain mirror entry in the Dreamhost panel under your main WordPress Network domain (i.e. subdomainA.rebelpeon.com)
  3. Create the subdomain mirror entry in the Dreamhost panel for the site you want (i.e. subdomainA.displaydomain.com)
  4. Add in the domain mapping
  5. Celebrate!

CloudFlare

I was using CloudFlare for awhile, but realized it was causing a few issues.  In practice it sounds like a great idea, essentially the same as any CDN, but free.  However, when editing posts on other websites, WordPress was never able to adjust the ajax to format the  text in the visual viewer.  It wasn’t really that it didn’t render it, it was more that it would take until a timeout is hit to render anything in the body field.

Simply not acceptable.  As soon as I deactivated CloudFlare, it worked great.  Needless to say, it’s not something I really need, so I just removed it.

Migration to WordPress Network Part 2

I had two outstanding items to figure out before migrating my last site.  Today I was able to knock off one.

My Director installation used to be a directory under my website.  Unfortunately, with migrating to a wordpress network, that wouldn’t work.  This is because everything is done via DNS redirection and so a directory doesn’t physically sit where you think it does.  I can only think of the nightmares it could cause.

Instead, I moved it to a sub domain.  This seemed to fix all the issues, and it is actually pretty nice there.  I just had to update a few links on various pages, make a few php.ini updates, and all was well.

Now it’s on to the massive site.  I think I have to import only a few records at a time.  Turns out, with all the media attached to each post, it kept timing out.

Update: Well, that was a fun experiment.  Since I can’t seem to upload any of my previous entries (Dreamhost kills the script), I’ve decided things are working ok with two WordPress installs, and that’s how it will stay.  The other site is huge anyways, so it makes sense…

Migration to WordPress Network

Well, the migration to a WordPress Network is nearing completion.  All sites, except for my largest (in terms of uploaded content) have been migrated, and figuring out what I’m going to do with my Director install.  This will save me so much time with upgrades and various other maintenance from now on.

I know that I had a post about this earlier, specifically how to do this on Dreamhost, but I thought I’d provide a few additional insights.

  1. If you are using subdomains instead of folders, do not have Dreamhost tack on www to the root Network domain until after you’ve migrated all sites over.  If you aren’t migrating, but simply setting up all new sites, then you don’t have to worry about it.  This causes issues because it tries to resolve subdomain.domain.com to www.subdomain.domain.com, which doesn’t exist.
  2. I am using full domains to map to the subdomains via the WordPress MU Domain Mapping plugin.  If you want to have non-www resolve to www, make sure www.notnetworkdomain.com is your primary and notnetworkdomain.com is also listed.
  3. If you have the Domain Mapping already setup to point to your www.notnetworkdomain.com during the migration, when you try to hit subdomain.networkdomain.com, it will redirect you to www.notnetworkdomain.com.  That is, reverse mappings happen also, which is cool.
  4. Depending on when you setup your domains at Dreamhost, it is possible their A records point to different IP addresses.  Mirroring only works when they have the same A record IP.  This happened to me on quite a few domains.  To fix, simply delete the domain from Dreamhost, then recreate it as a mirror.  Once the mirror is created, re-setup your custom MX records or any other DNS records you originally had.
  5. Don’t import entries on a crappy network connection.  It doesn’t work and continuously times out.

Outside of those issues, it went fairly painlessly.  It also helps if you have someplace that has quickly updating DNS.  I can’t tell you how many times I saw the “bad_http_conf” error, while I was waiting for DNS to propagate.

I’m also amazed at how easily most of the plugins have worked with the network config.  I was really expecting more pains in that area.

WordPress Network on Dreamhost

I’m just copying these instructions here, since I can’t seem to reliably access the website they are currently hosted on.

I think I’m going to change a few ways things are hosted here on my collection of sites.  It is a pain to keep them all updated and managed.  Therefore, I am looking into migrating to a WordPress Network (Multi-Site) setup.  However, using subdomains doesn’t work with Dreamhost because of Dreamhost not allowing wildcards.

Here is the work-around (verbatim) from a fellow Dreamhost user.

  1. Fol­low the direc­tions for set­ting up your Word­Press mul­ti­site (I will assume that you already know or have found the direc­tions to do so).
  2. Pick the sub­do­main fea­ture while in setup.
  3. Ignore the mes­sage you get say­ing that things may not work prop­erly because of the Wild­card missing.
  4. When you’ve fol­lowed all those won­der­ful instruc­tions, cre­ate a test blog. You may end up with a URL like domain.comdatabase_name. I did, and con­tinue to do so. Just edit that blog’s set­tings (Super Admin -> Sites -> Edit) so that the Path field only has a / in it. I’m unsure if this is a prob­lem that user’s at other hosts have, or if it is exclu­sive and will soon be fixed, but once it is changed all is well.
  5. Go to your Dreamhost Web Panel and mir­ror a sub­do­main for the blog you just added to the domain you set the mul­ti­site up on. NOTE: If you cre­ate blog.domain.comin Word­Press mul­ti­site, you must cre­ate the same sub­do­main in your Web Panel — blog.domain.com. Visit blog.domain.com and ver­ify that it leads you to the new blog you created.
  6. If that works, then you need to install the Domain Map­ping plu­gin for multisite.
  7. This gives you a new menu to add a domain to your net­work and “park” it over a subdomain.
  8. All you have to do is fol­low the direc­tions there to add the domain, and you are set.
  9. Just mir­ror that same domain to the mul­ti­site domain in your Dreamhost Web Panel, and every­thing should be in work­ing order.

Now on to testing!

Dreamhost Increase PHP Upload Size

Needed to upload some videos into my SlideShow Pro Director install.  However, my PHP upload size was set to 20MB and the videos were both 23MB.  After some Googling, I found a painless way to fix it.

  1. Ensure your domain is running FastCGI for PHP5
  2. Download DreamHost Custom PHP.ini from DeamHost Scripts and Tips
  3. Put the dh-phpini.php file at the root of your website
  4. Access http://<website>/dh-phpini.php
  5. Click to install and it will create the necessary files and folder
  6. Edit the php.ini in the newly created /cgi-bin/ folder in the following two places: post_max_size, and upload_max_filesize
  7. SSH into your website and run the following command for it to take affect (kills FastCGI): killall -9 php5.cgi

All this good info was found at BlueSunray, so thanks for that!

Published
Categorized as web