EC2 Wordpress Setup

Web

Ok, if you've been following this series you should have an EC2 instance up and running, but not serving up squat. Today we'll get Wordpress up and running. The main steps are:

  1. Apache
  2. Wordpress
  3. MySql
  4. Security

Thankfully, none of these are going to be the deal-breaker! :-DFirst off, let's deal with Apache.The way things are installed by default would be bad for Apache -- it's default assumes a lot more memory than you get with a micro instance.So, let's edit the configuration:

sudo nano /etc/httpd/conf/httpd.conf

The only thing I've changed is the bit that looks like this:

<IfModule prefork.c>StartServers 5MinSpareServers 5MaxSpareServers 5ServerLimit 5MaxClients 5MaxRequestsPerChild 4000

This is around 10% down through the file. What we're doing is setting the maximum number of web server processes. Five is enough for most small sites.Next, we need to configure a web sites. Most of the way down the file just un-comment the following line:

NameVirtualHost *:80

This will inform that you'll be hosting multiple web sites. Now, I don't really know that you will be, but there's little problem to do this now.Next, you'll want to create a file to configure your site. I'm going to call it www.site.com, but please configure it to be whatever you need it to be! Save the file, then:

sudo nano /etc/httpd/conf.d/www.site.com.conf

Type this into that file and save:

<VirtualHost *:80>  ServerName www.site.com  DocumentRoot /var/www/www.site.com    Options FollowSymLinks    Allow from all    AllowOverride all

This will get apache serving up that directory with that URL.Next, we need MySql up and running.First, let's create a password for root...

mysqladmin -u root password some-password

Then:

mysql -u rootCREATE SCHEMA `WordpressDatabaseName`;CREATE USER 'WPDBUser'@'localhost' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON WordpressDatabaseName.* to 'WPDBUser'@'localhost';

This will make a new database in MySql, a new user, and grant that new user access to the database.Finally, let's configure MySql for a small memory footprint:

sudo cp /usr/share/mysql/my-small.cnf /etc/my.cnf

Next, let's set up both Apache and MySql to start by default:

sudo /sbin/chkconfig --levels 235 httpd onsudo /sbin/chkconfig --levels 235 mysqld on

Ok.At this point we're just about ready to install Wordpress!

cd ~wget http://wordpress.org/latest.zip unzip latest.zipsudo cp -R wordpress /var/www/www.site.comsudo chmod -R apache /var/www/www.site.com

Things are just about ready to go now!Last, we need to set up security in EC2. In the EC2 dashboard, go to the security section. From there, select the security group that you picked for your instance and add HTTP (port 80) to it.While you're at it, configure an elastic IP and point it at the instance as well.Once you have that done, start up MySql and Apache.

sudo /etc/init.d/mysqld startsudo /etc/init.d/httpd start

From here you should be able to go to your IP address in a web browser and follow along with the questions Wordpress will have for you.Congrats! You have a blog!   

Previous
Previous

EC2 Final Wordpress Setup

Next
Next

Kitchen Chromatography