Setting Up the Optimal Hosting Environment

This chapter assumes that you already have the WordPress software installed and running correctly on your Web server, and that your Web server meets the minimum requirements to run WordPress.

Before you enable the WordPress multisite feature, you need to determine how you are going to use the feature. You have a couple of options:

  • Manage just a few of your own WordPress blogs or Web sites.
  • Run a full-blown blogging network with several hundred different blogs and multiple users.

If you are planning to run just a few of your own sites with the WordPress multisite feature, then your current hosting situation is probably well suited. However, if your plans are to host a large network with hundreds of blogs and multiple users, you should consider contacting your host and increasing your bandwidth, as well as the disk space limitations on your account.

The best example of a large blog network with hundreds of blogs and users (actually, more like millions) is the hosted service at WordPress.com (http://wordpress.com). At WordPress.com, people are invited to sign up for an account and start a blog using the network feature within the WordPress platform on the WordPress server. When you enable this feature on your own domain and enable the user registration feature, you are inviting users to

  • Create an account.
  • Create a blog on your WordPress installation (on your domain).
  • Create content by publishing blog posts.
  • Upload media files such as photos, audio, and video.
  • Invite friends to view their blog, or to sign up for their own account.

image In addition to the necessary security measures, time, and administrative tasks that go into running a community of blogs, you have a few more things to worry about. Creating a community will increase the resource use, bandwidth, and disk space on your Web server. In many cases, if you go over the allotted limits given to you by your Web host, you will incur great cost. Make sure that you anticipate your bandwidth and disk space needs before running a large network on your Web site! (Don't say we didn't warn you.)

Checking out shared versus dedicated hosting

Many WordPress Network communities start with grand dreams of being a large and active community. Be realistic on how your community will operate in order to make the right hosting choice for yourself and your community.

Small blogging communities can be easily handled using a shared-server solution, whereas larger, more active communities should really consider a dedicated-server solution for operation. The difference between the two lies in their names:

  • Shared-server solution: You have one account on one server that has several other accounts on it. Think of this as apartment living. One apartment building has several apartments for multiple people to live, all under one roof.
  • Dedicated-server solution: You have one account. You have one server. That server is dedicated to your account, and your account is dedicated to the server. Think of this as owning a home where you don't share your living space with anyone else.

A dedicated-server solution is a more expensive investment for your blog community, while a shared-server solution is the most economical. Your decision on which solution to go with for your WordPress Network blogging community will be based on your realistic estimates of how big and how active your community will be. You can move from a shared-server solution to a dedicated-server solution if your community gets larger than you expected; however, starting with the right solution for your community from day one is easier.

Exploring subdomains versus subdirectories

The WordPress network feature gives you two different ways to run a network of blogs on your domain. You can use the subdomain option or the subdirectory option. The most popular option (and recommended structure) sets up subdomains for the blogs created by your WordPress Network. With the subdomain option, the username of the blog appears first, followed by your domain name. With the subdirectory option, your domain name appears first, followed by the username of the blog. Which one should you choose? The choice is yours. You can see the difference in the URLs of these two options by comparing the following examples:

Apache mod_rewrite

Apache (http://httpd.apache.org) is Web server software that's loaded and running on your Web server. Not everyone has access to Apache files, however. Usually, the only person who has access to those files is the Web server administrator. (This is usually your Web host.) Depending on your own Web server account and configuration, you may or may not have access to the Apache software files.

The Apache module that's necessary in order for the WordPress Network to create nice permalink URLs is called mod_rewrite. This must be configured so that it's active and installed on your server.

You or your Web host can make sure that the Apache mod_rewrite is activated on your server; open the httpd.conf file and verify that the following line is included within:

LoadModule rewrite_module /libexec/mod_rewrite.so

If it isn't, type that line on its own line and save the file. You will probably need to restart Apache before the change takes effect.

While the network is being set up, tables are added (to the database) that contain information about the network, including the main site URL. If you're developing a site or want to change the domain later, you need to change every reference to the domain name in the database. Look at Book II, Chapter 3 to find more about the WordPress database structure, including how data is stored in tables, as well as the use of popular database administration tool called phpMyAdmin to manage, view and edit database tables.

Choosing Linux, Apache, MySQL, and PHP server snvironments

A network of sites works best on a LAMP (Linux, Apache, MySQL and PHP) server with the mod_rewrite Apache module enabled. Mod_rewrite is an Apache module that builds URLs that are easier to read (also, see the nearby “Apache mod_rewrite” sidebar for more information). In WordPress, this is used for permalinks. If your install uses any permalink other than the default, ?p=123, then you're okay. Your Web host can help you determine if your Web server allows this. It is a requirement for setting up the WordPress multisite feature (more information on permalink structure can be found in Book III, Chapter 3).

For the purposes of this chapter, we stick to the LAMP server setup because it is most similar to the average Web host, and most widely used.

image Remember that the Apache mod_rewrite module is required for WordPress multisites. If you do not know if your current hosting environment has this module in place, drop an e-mail to your hosting provider and ask. They will be able to answer that question for you (in addition to installing the module for you in the event that your server does not yet have it).

image Networks also work well on Nginx and Lightspeed servers; however, many users have reported having much difficulty on IIS (Windows) servers. Therefore, we don't recommend setting up WordPress, with multisite features, on a Windows server environment.

Subdomain sites work by way of a virtual host entry in Apache, also known as a wildcard subdomain. On shared hosts, your Web hosting provider support team will have to enable this for you, or they may already have done so for all accounts. It is best to ask your hosting provider before you begin. In these situations, the domain you use for your install must be the default domain in your account. Otherwise, the URLs of your subsites will fail to work properly or to have a folder name in the URL.

image Some hosts may require you to have a dedicated IP address, but this is not a specific software requirement for a WordPress network to function.

Before proceeding with the final steps in enabling the WordPress multisite feature, you need to get a few items in order on your Web server. You also need to make a decision about how the multiple blogs within your network will be handled. These configurations need to be in place in order to run the WordPress Network successfully.

image In the next section, you edit and configure Apache server files. If you can perform the configurations in this section yourself (and if you have access to the Apache configuration files), this section is for you. If you don't know how, are uncomfortable with adjusting these settings, or don't have access to change the configurations in your Web server software, you need to ask your hosting provider for help or hire a consultant to perform the configurations for you. We can't stress enough that you should not edit the Apache server files yourself if you aren't comfortable, or don't fully understand what you are doing. Web hosting providers have support staff to help you with these things, if you need it — take advantage of that!

Adding a virtual host to the Apache configuration

You need to add a hostname record pointing at your Web server in the DNS configuration tool available in your Web server administration software (like WebHost Manager (WHM), a popular Web host administration tool). The hostname record looks like this: *.yourdomain.com (where yourdomain.com is replaced with your actual domain name). Follow these steps to enable the wildcard subdomains in Apache:

  1. Log in as the root user to your server.
  2. Open the httpd.conf file or the vhost include file for your current Web account.
  3. Find the virtual host section for your domain.
  4. Add the wildcard subdomain record next to the domain name.

    It will look like this:

    ServerAlias yourdomain.com *.yourdomain.com
  5. Save the file.
  6. Restart Apache.

You will also need to add a wildcard subdomain DNS record. Depending on how your domain is set up, this can be done at your registrar or your Web host. If you simply pointed to your Web host's nameservers, then you can add more DNS records at your Web host in the Web server administration interface, such as WHM (Web Host Manager).

You also should add a CNAME record with a value of *. CNAME stands for “Canonical Name” and is a record stored in the DNS settings of your Apache Web server that tells Apache you would like to associate a new subdomain with the main account domain. Applying the value of * tells Apache to send any subdomain requests to your main domain, and from there, WordPress looks up that sudbomain in the database to see whether it exists.

Networks require a great deal more server memory (RAM) than typical WordPress sites (not using the multisite feature), simply because multisites are generally bigger, have a lot more traffic, and use up more database space and resources because multiple sites are running (as opposed to just one with regular WordPress). You aren't simply adding instances of WordPress. You're multiplying the processing and resource use of the server when you run the WordPress multisite feature. Although smaller instances of a network run okay on most Web hosts, you may find that when your network grows, you need more memory. We generally recommend that you start with a hosting account that has access to at least 256MB of RAM (memory).

For each site created, nine additional tables are added to the single database. Each table has a prefix similar to wp_BLOG-ID_tablename (where BLOG-ID is a unique ID assigned to the site).

The only exception to this is the main site. Its tables remain untouched, and remain the same as you saw in Book II, Chapter 3. With WordPress multisites, all new installations will leave the main blog tables untouched, and number additional site tables sequentially, with every new site that is added to the network.

Much discussion about the database layout has occurred in Trac, WordPress's codebase management system, and in the WordPress.org forums. Although it may seem unwieldy, it will scale appropriately. Limitations on database size have more to do with the server and database management tools. The average users build a small to medium-sized network, which usually needs no more than a VPS account.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.200.105