Multiple domains pointing to a single installation of WordPress

My blog, this site, actually has three URLs coming to it.

  • http://marcovescio.com
  • http://vesc.io/
  • http://marco.vesc.io/

These are the three URLs that I choose to use in various places to link back here. Of course, it could be infinitely more. I could link Any-Sub-Domain-I-Want.marcovescio.com if I really needed to.

But back to my three URLs: I don’t want three different blogs. I want them all to come back to this one WordPress installation. At least for now…

Additionally, I’d like navigation to stay on the domain that each user entered the site on: Usually because I’ve pointed them to that particular link for a particular purpose. Or they followed it from my resume, business card, or other source.

Configure DNS

The three URLs are actually only two domains: marcovescio.com and vesc.io

Each domain has a wildcard subdomain A record in their DNS (the subdomain is a *)

Configure Virtual Host

The server is listening for all subdomains of each domain

Configuring WordPress

At this point, you can enter my site from any subdomain and that page will initially display. But what happens when you click a link? Well, it uses the WordPress Address (URL) and Site Address (URL) options you’ve configured in Settings -> General.

We can get around this by blanking out both options — but this must be done from wp-config.php

Add the following lines to wp-config.php:

Final Notes

Don’t forget to clear your cache.

WordPress Blank Page (PHP error)

A wordpress blank page (or white page of death) is the result of something going very wrong in PHP.

The vast majority of the time, it is a plugin. You can disable all plugins and login by ‘hiding’ your plugins folder. I typically do this by renaming it:

rename the plugins folder and login to wp-admin. If you want to disable all the plugins click on “plugins” after you’re logged in. Then you can move the folder back.

Other common reasons you can get the blank page:

  • PHP Short Tags. Change short_open_tag to On in php.ini (or php-fpm pool, or wp-config.php ). If you’re seeing errors such as “unexpected end to file” for your theme or plugin, it is very likely because a short open tag is being used but not configured so it is unable to parse.
  • Your theme. Try temporarily removing it or going back to a default WordPress theme
  • Not enough memory assigned to PHP. Crank up your php memory_limit option

Revisiting old posts

At the beginning of 2014 (like.. last week) I decided to re-launch my personal site. I thought this would be a simple process but as I look at old posts, I realize how quick technology changes and it angers me. Also, how awful some of my previous posts were written up.

“Who cares? It is what it is! Move on with your life!”

“Just import all your old posts. Update them as you can. It’s fine.”

“NO! These are awful. You really need to go through them one by one and totally redo everything to be perfect or it will just nag you incessantly. I WILL nag you incessantly.”

So I finally stopped arguing with myself — it was weird and upsetting those around me — and decided I was going to go through each one at different levels of re-writing. Some I’m just fixing some formatting and they’re going up… Others, oh man.. so much has changed!? How did I ever think I knew what I was talking about?! How did I not realize the futility of attempting to be cutting edge and make a post about it on the internet?!

Install and Run Linux Malware Detect (maldetect, maldet)

Linux System Administration – Basics Series!

Linux Malware Detect (or just Maldetect / Maldet) is a great anti-malware tool that any Linux SysAdmin should be aware of. Works great with ClamAV installed as it utilizes the ClamAV engine.

Official project page here: https://www.rfxn.com/projects/linux-malware-detect/

Download & Install Maldetect

 Update Maldetect

The following commands will update the actual program and the malware definitions.

Run Maldetect

Personally, I would run this in a screen session so you can go on your merry way and come back to it later.

When scan is complete you can view the report by entering the command listed at the end of the scan:

or you can view the report file directly. they are located in

You can quarantine the files easily.

 

Admin + Apache + NGiNX accessible when using DSO php handler.

So you want your WordPress or Jooma or (insert other CMS with web dashboard here) to work but you also want to upload things via FTP and it keeps messing up permissions?

Most likely you’re (a) not on a shared host nor (b) using something like cPanel with suPHP as your PHP handler. In fact, you’re most likely running your own setup with the default DSO php handler.

Now you could just give everything 777 permissions (stand by for a post on why this isn’t as bad as people have lead you to believe but I still recommend against it!) or you could do the smart thing and make a group!

I’m going to show you how I typically work around this problem for my clients and myself, with a group!

Remove ACLs that could interfere

I find a lot of weird things on servers where people have been “playing” around with permissions that work. You can ignore this if you have never used setfacl before. This will clear whats there. -R being recursive and -b being to wipe

Change directories and files to be group readable / writable

Another common issue I find is that by the time I’ve been asked to help, my client has given up and made everything 777 but then got freaked out when they heard 777 is WORLD WRITABLE (AHHHH!! OMG!! Okay thats true but the ‘world’ ends at the server level). I always set folders and files back to 775 and 664.

775 and 664 vs 755 and 644 because we’re giving “group” some elevated permissions rather than just the user.

Setup the group and set permissions

Then I create a “www” group. You’ll also often see “www-data” or on shared hosts, some group related to your account number. This group holds all the users that need access to your files, in this example “admin” (as my ftp user) and “apache” as my Apache web server user.

Also, at the end, I grant group +s
+s gives it sticky permissions. This means the group retains the owner of its parent so regardless if “admin” edits the file or created a new file in the folder or “apache” edits the file or creates a new file in the folder, the group will always remain “www”.

If you’re using WordPress…

Almost everything I post is centered around WordPress. I do a lot of work directly related to WordPress so its fitting I have handy instructions for such a scenario!

WordPress doesn’t check to see if it can actually write. It just checks to see if the USER is the same as the webserver user then degrades down to a prompt asking for FTP credentials so it can make the change.

The following lines has wordpress actually check the filesystem and see if it has the ability to manage the file (which it will through group permissions) and it will maintain permissions of 775 and 664 for folders and files, respectively. (Default for WordPress is 755 and 644).

 

New site!

It’s January 2nd. I wanted a change. So I rebooted my personal site.

Feels good. Clean. Empty. Modern.

Maybe I should import the old content. yawn. Another day.

Zoe’s cupcake cookies

I LOVE Zoe’s cupcake cookies — they’re perfect for any party but especially winter holiday’s (as are all cookies..) — but I keep forgetting the damn recipe! So here it is. Where I can find it. Maybe I should post all my favourite recipe’s here and stop going crazy each time I need to make them, trying to remember how to do it.

Zoe’s cupcake cookies
Prep time:
Cook time:
Total time:
Ingredients
  • 1 package of yellow cake mix
  • 1/2 stick of butter
  • 1 package of cream cheese
  • 1 egg
  • 1 tsp vanilla
Instructions
  1. Mix all ingredients until well blended
  2. Refridgerate for 30 minutes
  3. Bake at 325 for 8-10 minutes