Creating a Scalable Cloud Infrastructure for WordPress needs multiple Web Servers, multiple MySQL Database Servers, Cloud Loadbalancers. Here is full tutorial. For this Example Guide for Creating a Scalable Cloud Infrastructure for WordPress, we have described the way for The Rackspace Cloud, though any Cloud Server of similar niche can serve the purpose. Just for easiness to integrate our our previous guides, we have used WordPress as CMS for this guide on Creating a Scalable Cloud Infrastructure for WordPress, one can however modify the idea to accommodate for other CMS.
Resources needed for Creating a Scalable Cloud Infrastructure for WordPress
- We always prefer that you are using Mac OS X or any distro of Linux, that will make easy to run the console using terminal plus those virus, malware stuffs are avoided. However you can use PuTTY under Windows.
- The Rackspace Cloud account or similar Cloud Server that can support the configuration.
- Basic idea on UNIX commands, our guide on how to Install WordPress on Rackspace Cloud Server will give you enough idea.
- This guide on how to Create DNS Record for Rackspace Cloud Servers will help you to point your domain. But, DNS for Creating a Scalable Cloud Infrastructure, you will point the domain to the load balancer’s IP address.
- 5 Servers – 2 Web Servers, 2 MySQL Database Servers and One Memcached Server
Creating a Scalable Cloud Infrastructure : Configuring the Servers
Install CentOS recent version with at least 1 GB of RAM (scale up or down as per need) Install LAMP on all 5 servers. It is important to name the servers properly for Creating a Scalable Cloud Infrastructure. Read first for these extra tweaks before starting :
- Configure two web servers with Postfix Email Server. The first step before installing Postfix is to make sure that Sendmail is not already running on your system. To install it, use the following command:
yum install postfix
- The main configuration settings for Postfix are located in the /etc/postfix/main.cf file. You can check Official documentation for more.
- Configure two web servers with SendGrid (optional) for Rackspace. This is nothing but SMTP Service Package.
- There is no need to run MySQL in two web servers.
- On the other hand, on Database Servers, there is no need to run Apache with its modules.
- The above two tweaks for Creating a Scalable Cloud Infrastructure for WordPress is to optimize the performance. You can selectively disable more running services very carefully if you are a Linux expert.
- You probably have already installed Apache virtual host to each Web Servers to point to the WordPress root directory.
- One of the Web Server will be the main webserver, other will replicate it. You will need to install Live Syncing (Mirror) Daemon Lsyncd. You will get the manual for using it on GitHub. After this, you will work only on main webserver. Your both webservers will run mod_php by default. Disable it. Install either suPHP Apache module or you can use PHP-FPM and suexec. Any of them will make the management within the WordPress Admin panel possible.
- Install the memcache PHP module on main webserver. Set it to to save sessions.
- Now the Memcached Server. We need to install it. Use these commands :
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
yum install memcached
We need to configure it, most important value to configure is cachesize. This example shows size of 1024 MB :
nano -w /etc/sysconfig/memcached
Please check official website of memcached for more help.
- Configure the database servers. This part actually depends on which Cloud Host you are actually using. Basically, you need to install memcached on the database nodes and follow their directions. Ultimately, you need to allow connections via IPTables from the web nodes and selectively use one for caching.
- Allow connections via IPTables from the webservers
- Now closer to the final Step, install WordPress on the main webserver
The important step of Creating a Scalable Cloud Infrastructure for WordPress is configuring the load balancers
Otherwise nothing will work as we have pointed at the beginning towards the loadbalancer’s IP. It is fully depends on which service you are using. Using all is GUI based, its quite easy to set up.
Cost of Creating a Scalable Cloud Infrastructure for WordPress
For Rackspace, Creating a Scalable Cloud Infrastructure for WordPress like above will cost around $270 per month for unmanaged Cloud Servers.