WordPress on Amazon EC2 – Part 6 – MySQL and Apache

Yesterday we installed the software we'll use to run WordPress. Today we'll configure it all up.

The Apache web server

Let's start with some simple stuff: PHP.Edit /etc/php.d/ini and modify one line:

$ sudo nano /etc/php.d/apc.ini

You want to change a line to look like this:

; The mktemp-style file_mask to pass to the mmap moduleapc.mmap_file_mask=/apc.shm.XXXXXX

Most config files look like "name = value". When I say "change a line," what I'm meaning is find the line that starts with the name and change the value.Once you've changed it, save the file.Next up need to configure Apache to serve up the directory we want.

$ sudo nano /etc/httpd/conf.d/blog.vec.com.conf

I like to name the configuration files after what's being served by that configuration. You can really call it anything that ends with ".conf". You probably don't want to call it "yoursite.com". Just sayin'. :-)Put this in the new file:

<VirtualHost *:80>ServerName www.yoursite.comDocumentRoot /var/www/www.yoursite.com<Directory /var/www/www.yoursite.com>Options FollowSymLinksAllow from allAllowOverride all</Directory></VirtualHost>

Like before, replace the "yoursite.com" with something more useful to you. Whatever you put there will dictate what your server will respond to. (Assuming you have the DNS pointed to the server)Before we restart Apache, let's make the directory.

$ sudo mkdir /var/www/yoursite.com$ sudo service httpd restart

As an added bonus, you can host multiple sites on one server as well, just add additional configs and make more directories.

MySQL

First, let's start up mysql with their default medium config:

$ sudo cp /usr/share/mysql/my-medium.cnf /etc/my.cnf$ sudo chkconfig mysqld on$ sudo service mysqld start$ /usr/bin/mysql_secure_installation

After the last command you'll be prompted to set your main "root" database password. Set it to something secure. The rest of options are pretty much spot on.As an added bonus, you now know that MySQL is working just fine!Next up: Setting up WordPress! Finally!

Previous
Previous

Close to home

Next
Next

WordPress on Amazon EC2 – Part 5 – Installing software!!