If we setup a separate database server on Rackspace Cloud Server, the setup becomes more scalable and less vulnerable to security exploits. Yes, there is definitely Rackspace Deployment which automates the process, but for learning purpose or for custom, personalized need; we obviously need to know the step by step guides from command line. Normally, we always (and all in this world) give example of installing WordPress on one server.
So, in this guide, we will discuss the next step of configuring a setup on Rackspace Cloud. Here, we will use some terminologies which are specific to either Rackspace Cloud or OpenStack. One might not be able to use them on different IaaS provider. Obviously, the basic idea can be used on any IaaS provider running Linux as OS.
Setup Separate Database Server on Rackspace Cloud : First Things First
If you are migrating or planning to migrate your existing setup from one server; you must use two newly build Ubuntu instances. Guide for Installing WordPress on Rackspace Cloud Server is remaining the same in essence, but we will modify it to certain degree. We recommend to use :
---
- Rackspace Cloud Files as CDN
- Rackspace Load Balancer as to face the traffic
Thus, one must need to master the basics of one server configuration before the attempting to configure the setup in this way. A big plus for Rackspace is that – we are not billed for the Intranet bandwidth (Service Net), so one can calculate the end bill quite easily by simply multiplying the cost incurred by a server without assuming the bandwidth consumption.
Setup Separate Database Server on Rackspace Cloud
We are providing the example with a typical WordPress instance running on LAMP server. Here is the blueprint of the practical idea :
So, on the main server, we need these set of operations ( Please Look at the old Hyperlinked guide for detailed steps ) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ~ sudo apt-get install lamp-server^ ~ cd /var/www/html && rm -r index.html ~ sudo nano /etc/apache2/apache2.conf # add this lines and save ServerName thecustomizewindows.com # reload apache ~ sudo service apache2 restart ~ sudo apt-get install php5-curl php5-gd ~ sudo apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions libapt-pkg-perl -y # some components will not be installed but that will not matter, the explanation is bigger ~ sudo service mysql stop # see http://dev.mysql.com/doc/refman/4.1/en/automatic-start.html to stop mysql on reboot # we installed mysql with lamp-server^ package # download wordpress ~ wget http://wordpress.org/latest.tar.gz # un-tar it ~ tar -xzvf latest.tar.gz # cd to wordpress folder ~ cd wordpress # move all the files to root ~ mv * .. # dot dot ==> one level up in Linux |
On the second server, we only need MySQL to run.
1 2 3 4 5 6 7 8 9 10 11 | sudo apt-get install mysql-server # edit the /etc/mysql/my.cnf file to configure the basic settings like log file, port number, etc. # For example, to configure MySQL to listen for connections from service net network host, change the bind-address directive to the server's IP address: ~ sudo nano /etc/mysql/my.cnf # change ip bind-address = 192.168.0.5 # guides on # https://help.ubuntu.com/12.04/serverguide/mysql.html # advanced http://dev.mysql.com/doc/refman/5.0/en/multiple-servers.html |
Now, we have the Service Net IP of the database server. First we need to create a database, an database user and add password :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ~ mysql -u root -p # MySQL Welcome message will appear. Do not copt " > " > CREATE DATABASE wordpress; Query OK, 1 row affected (0.00 sec) > CREATE USER wordpressuser@localhost; Query OK, 0 rows affected (0.00 sec) > SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password"); Query OK, 0 rows affected (0.00 sec) > GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec) > FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) > exit Bye ~ # wordpress, wordpressuse and password must be changed |
While installing WordPress, you will use the Service Net IP, that will work fine. Behind load balancer, add your one server (other than the database server) and allow only port 80 to get exposed. Your main servers IPs are now masked by load balancer’s IP. Even if wp-config
becomes accessible, it is practically impossible to get an access to the database server.
This is an abstract of the idea of how safe configurations are done on high load production server.