Top Nav

Multiple Domains One WordPress

Let’s say you want to have more then one domain pointing to a WordPress site. Each domain should show the same content but you don’t want to redirect to the primary domain. This is a problem with WordPress because it tries to redirect to a single canonical domain. The solution is the “Any Hostname” plugin:

https://wordpress.org/plugins/any-hostname/

After installing the plugin, go to:

WordPress Admin -> Settings -> General

At the bottom of the screen you’ll find an “Any Hostname” section where you can add additional domain names to the site. So now you can have “www.acme.com” as the primary domain and one or more additional names like “www.acmeinc.com”. The website will be displayed on each domain as if it were the primary with no redirect.

0

Plesk & New Relic

New Relic is a great tool for managing website performance. Recently worked to setup a Plesk 12 server with New Relic. We wanted to have each virtual host on the website represented by an Application in New Relic as documented here:

https://docs.newrelic.com/docs/agents/php-agent/configuration/php-directory-ini-settings

We found a few useful points that we want to share:

1. The newrelic.appname must be removed from /etc/php.d/newrelic.ini.  If the appname is defined in this file then individual virtual hosts will not be able to override and provide there own appname. Just edit the file and comment out the line like:

2. Set the appname for each virtual host from Plesk by going to:

and adding a line like this:

to the “Additional configuration directives” field. Notice that the appname has two components separated by a semicolon. The first is the domain for the site and the second is the fully qualified server hostname. So for example you might do:

and then another site on the server might be:

Now in New Relic, you’ll see three applications. One for store.acme.com, one for blog.acme.com and one for the entire server called web1.acme.com.

0

Fonts & RackSpace Cloud Files

If you try to serve fonts from RackSpace Cloud Files or other CDN then you may run into problems with browsers refusing to load the fonts. Here’s an example error:

Font from origin ‘http://xxxxx.xxx.rackcdn.com’ has been blocked from loading by Cross-Origin Resource Sharing policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://www.acme.com’ is therefore not allowed access.

The problem is your browser doesn’t consider it secure to load the font from a different domain then the web page itself was loaded from.

The solution is CORS or Cross-Origin Resource Sharing as described here:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

When RackSpace Cloud  Files serves the font file, it needs to set a header like:

or more specifically:

This informs your browser that it is save to include this resource in the indicated alternate origin.

RackSpace Cloud Files provide a means to change the headers on individual files. Here’s the technical details:

http://docs.rackspace.com/files/api/v1/cf-devguide/content/Assigning_CORS_Headers_to_Requests-d1e2120.html

You can also set headers from the mycloud.rackspace.com portal. Just login, go to Storage -> Cloud Files and locate your font file. Click the gear icon and choose Edit Headers. A dialog will open where you can set the “Access-Control-Allow-Origin” header.

Note that it takes some time for header changes to propagate through the CDN. I always purge the file after making changes in the hopes that this will accelerate propagation but I can’t confirm that it helps.

With the addition of CORS headers you can reliably service your font files from the CDN!

0

Disable PHP zlib.output_compression

If you need to disable zlib output compression from the .htaccess file, then just add the following line to the top of the file:

 

0

Install Percona Server 5.5 On CentOS 6.5

Today we’re going to install Percona Server 5.5 on a CentOS 6.5 server. Our server is hosted on Amazon AWS but the procedure should be the same for any host.

Percona Server is a drop-in replacement for MySQL that features enhanced performance. You can learn more about Percona here:

http://www.percona.com/

We’re going to do our install using the Percona Yum repository. The documentation is here:

http://www.percona.com/doc/percona-server/5.5/installation/yum_repo.html

Lets get started by adding the repository. Run this command as root:

and you’ll get output similar to this:

Now if you run this command:

You’ll see a list of available packages like:

Since our goal is to install Percona 5.5, we’ll do the following:

The install proceeds like this:

As you can see a number of supporting packages were also installed.

Next let’s configure Percona to start on boot:

And run it for the first time:

which should give some output like:

Notice that the service name for Percona is “mysql” instead of “mysqld” which is used by MySQL.

At this point the Percona Server 5.5 install has been completed.

 

 

0