Not sure if this is webmaster or a WordPress question, it's a bit half and half, sorry if I'm posting in the wrong place.

Without using Multi-Site or installing new WordPress CMS' in second-level domains, what's the best way to get multiple WordPress installs running on my VPS (running Linux powered CentOS 6 with WHM and cPanel)?

It's currently working but only by setting the permalinks option to the default setting, so the URLs aren't human-friendly. I have come across something called WPSiteStack, though I'd really rather not go down this route.

Long story short, I need the following:

  • Seperate installs so one core / theme / plugin update doesn't affect all sites and increases security of all sites;
  • 'Pretty' permalinks;
  • Each WordPress install must be in the root of it's own domain to ensure that I can accurately measure my clients' quotas;

It may also be worth noting that some functions within each install use the $_SERVER['DOCUMENT_ROOT'] and $_SERVER['HOST'] variables.

I have already edited the httpd-vhosts.conf, httpd.conf and .htaccess files but this hasn't made any changes.

So any ideas what I'm missing or doing wrong? Any help is much appreciated.

UPDATE: mod_rewrite is definitely included and has been all along, though it's not working with custom post types on one install and not working at all on all other installs. So /%year%/%monthnum%/%day%/%postname%/ is only working for standard 'post' and 'page' post types on one install while on other installs, which don't use custom post types, it's not working at all so only default permalink setting works for them.

  • This is an Apache server config problem. Just install WordPress on individual VHosts, if your server is setup correctly you needn't do anything WordPress specific. – Tom J Nowell Sep 4 '12 at 21:34
  • Your question should be 'modrewrite not working on my Apache setup' – Tom J Nowell Sep 4 '12 at 21:35
  • Something which may be clue to why it's not working is the fact that the one site that I previously said was working is actually not working with custom post types whereas this was working perfectly fine the previous server which was just a standard Linux shared hosting package from Heart Internet. – Ben Sep 8 '12 at 20:05

This is fairly easy to set up using virtual host configurations in Apache or Nginx (depending on which webserver you want to run on your box).

Here's the gist of things:

1. Each installation will have a separate database and separate database user (for security).

I set these up manually in MySQL through the command line, but if you have phpMyAdmin set up, you can use that instead.

2. Each installation will be in its own directory. This keeps everything (core, themes, plugins) 100% separate.

For example, you might configure multiple directories for each domain. Assume you have myawesomesite.com and mybizsite.com, you'd set up:

  • /var/www/html/myawesomesite
  • /var/www/html/mybizsite

Each of these directories contains a distinct installation of WordPress. Separate files, separate wp-config.php, separate everything.

3. Use virtual hosts to listen for requests for each domain.

The default installations of both Apache and Nginx listen for all requests to an IP address and (usually) direct all traffic to /var/www/html. You can override this behavior by creating virtual hosts in your configuration to map specific host requests to specific folders.

For example, all requests to your IP address for myawesomesite.com would be served from /var/www/html/myawesomesite and all requests for mybizsite.com would instead be served from /var/www/html/mybizsite.

Keeping things separate like this also enables you to set up pretty permalinks because both sites use different .htaccess files (with Apache). So you could, essentially, have different permalink structures for each site.

Setting up a virtual host is pretty straight forward and well documented. There are tutorials around for just about every configuration. For Apache, you want to look up Name-based Virtual Hosts.

Setting one up in Nginx requires setting up a server_name in your configuration file. I use Nginx for all of my own hosting, and I did write up a tutorial on how I built up my CentOS server as well. Hope it helps!

  • Thanks, I will give this a thorough read and attempt it when I get more time, probably over the weekend. – Ben Sep 6 '12 at 18:31
  • I've managed to get to it working with just one site, others are no different from before. I've also reset the .htaccess files back to WordPress default just to be sure, checked that mod_rewrite is enabled and am I right in saying the 'AllowOveride' and 'Options' settings of the httpd.conf file will affect the url re-write? If so what's the optimal configuration to go for without adversely affecting security? – Ben Sep 7 '12 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.