WordPress Sites on a Cloud
Installing multiple WordPress sites with separate domain names on a cloud server is simpler than you may think.
Add the following records with your domain and your server’s IP address that you were emailed:
With the server’s root password that you were emailed, login via SSH:
ssh root@example.com
The authenticity of host 'example.com (00.000.000.000)' can't be established.
RSA key fingerprint is **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'example.com,00.000.000.000' (RSA) to the list of known hosts.
root@example.com's password: ********
Change root password:
passwd
Enter new UNIX password: ********
Retype new UNIX password: ********
passwd: password updated successfully
Change editor to vim:
update-alternatives --config editor
There are 2 alternatives which provide `editor'.
Selection Alternative
-----------------------------------------------
1 /usr/bin/vim.tiny
*+ 2 /bin/nano
Press enter to keep the default[*], or type selection number: 1
Using '/usr/bin/vim.tiny' to provide 'editor'.
Set the system locale:
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
Set your local timezone:
dpkg-reconfigure tzdata
Current default timezone: 'America/Los_Angeles'
Local time is now: Tue Dec 2 09:09:57 PST 2008.
Universal Time is now: Tue Dec 2 17:09:57 UTC 2008.
Add wordpress user:
adduser wordpress
Adding user `wordpress' ...
Adding new group `wordpress' (1002) ...
Adding new user `wordpress' (1002) with group `wordpress' ...
Creating home directory `/home/wordpress' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: ********
Retype new UNIX password: ********
passwd: password updated successfully
Changing the user information for wordpress
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y
Give wordpress user sudo privileges:
visudo
a
Add wordpress user at the end of the file:
wordpress ALL=(ALL) ALL
esc shift+: w q return
Add wordpress user to the www-data group.
usermod -a -G www-data deploy
Change wordpress home folder to the www-data user and group.
chown -R www-data /home/wordpress
chgrp -R www-data /home/wordpress
chmod -R 2750 /home/wordpress
Make default SSH configuration more secure:
vim /etc/ssh/sshd_config
a
Change or add the following within the file:
PermitRootLogin no
X11Forwarding no
UsePAM no
UseDNS no
AllowUsers wordpress
esc shift+: w q return
Reload the SSH configuration and exit:
/etc/init.d/ssh reload
exit
Create your public SSH key on your development computer:
mkdir ~/.ssh
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/******/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/******/.ssh/id_rsa.
Your public key has been saved in /Users/******/.ssh/id_rsa.pub.
The key fingerprint is:
**:**:**:**:**:**:**:**:**:**:**:**:**:**:**:** ******@***********.local
The key's randomart image is:
+--[ RSA 2048]----+
| .+=*oo=o |
| .oo++.. |
| ....+ |
| .. . |
| .S . |
| E . . |
| o = |
| = o |
| . |
+-----------------+
Copy the public key to the deploy home folder on the server:
scp ~/.ssh/id_rsa.pub wordpress@example.com:/home/wordpress/
wordpress@***.**.**.***'s password: ********
id_rsa.pub 100% 406 0.4KB/s 00:00
Add public key to wordpress user:
ssh wordpress@example.com "mkdir .ssh; mv id_rsa.pub .ssh/authorized_keys; chown -R wordpress:wordpress .ssh; chmod 700 .ssh; chmod 600 .ssh/authorized_keys"
wordpress@example.com's password: ********
Login as wordpress:
ssh wordpress@example.com
Upgrade current packages:
sudo aptitude update
sudo aptitude -y safe-upgrade
sudo aptitude -y full-upgrade
Install Apache, SQLite, Git and Ruby:
sudo aptitude -y install build-essential apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert sqlite3 git-core ruby1.8
sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby
Configure Apache server name:
sudo vim /etc/apache2/httpd.conf
a
Add the following:
ServerName yourslice
esc shift+: w q return
Enable Passenger:
sudo a2enmod passenger
Enabling module passenger.
Run '/etc/init.d/apache2 restart' to activate new configuration!
sudo /etc/init.d/apache2 restart
Configure your site:
sudo vim /etc/apache2/sites-available/example
a
Add the following:
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/deploy/example/current/public
esc shift+: w q return
Enable your site and reload Apache:
sudo a2ensite example
Site yourdomain installed; run /etc/init.d/apache2 reload to enable.
sudo /etc/init.d/apache2 reload