If you haven’t already setup your Ubuntu server, please read this post, and get the Ubuntu server running on AWS’ free-tier, first.  Otherwise, proceed here for the basic WordPress setup.   If you’ve never used WordPress, then now’s your chance to see how easy it can be to host your own web site, with a world-class content-management-system (CMS).  I’ll create another post in the future, with a list of plugins to add to WordPress.  The list will include plugins to make your site secure, Search Engine Optimized (SEO), and really, really, user-friendly for one to use as their own blogging or small-business web site.


This post assumes 2 things, 1) you are comfortable working from command line (i.e, ssh), and 2) you have a running LAMP server.  Also, you should have logged in and become root, or if you’re not running these commands as root, make sure to add sudo  prior to the commands.

Step 1 – Download and Install WordPress

Step 2 – Update ‘wp-config.php’ with Database and Key Info.

Now, edit wp-config.php with the database connection information; specifically the following bits are important.

Also, you’ll need to generate some key’s and salt values to be used by WordPress, so following the instructions in the comment.  Go here, to generate your own set of copy, and paste-able values.

It should look something like this, when you’re done.

That’s it, once you’ve connected the database, and setup the auth keys, you should be able to navigate to your site, and get the WordPress installer.  If you don’t know how to setup a MySQL database for WordPress, try searching the web for creating MySQL databases using phpMyAdmin.  phpMyAdmin, should already be setup if you followed along with the installation instructions from the previous post.  Otherwise, simply type: apt-get install phpmyadmin.  Additionally, for more information about getting started with WordPress, once it is installed, please see the WordPress documentation.

Step 3 – Setup Apache2 Config, and .htaccess for Rewriting and Security

One last thing, that should be done for security, is to limit access to the WordPress Admin System, to only the IP address(es) that I require to have access.  If you’re selling subscriptions, or using many WordPress plugins that require users to login via the WordPress login functionality, then you should skip this step.  For most purposes though, this is a good idea so that no one but you can get to your WordPress admin.

Start by opening the file: vim /var/www/html/.htaccess, and paste this:

To get your external IP address, and not the one most likely assigned by your (wireless or otherwise) router, go here, and copy/paste the IP displayed.  You will also need to make sure that your Apache virtual host is configured to allow overrides in .htaccess files to do this, edit the appropriate virtual host file under: /etc/apache2/sites-available/*.conf  and make sure the virtual host section has the following (or similar) Directory directive.  At the very least the highlighted lines should be present for the directory serving the .htaccess files.

After you save these files, you’ll need to tell the apache2 service to restart/reload, with: service apache2 restart # or service apache2 reload if you prefer.  Now navigate to your sites admin pages at: http://www.yoursitehere.com/wp-admin/, and feel safe, knowing you’re the only one who can get there.

Whenever starting/stopping apache2, it’s a good idea to do a service apache2 status, and look for a response similar to:

If you do not see this type of output, check /var/log/apache2/error.log  (or your configured error log in your apache2 config for your virtual host).  Type:  tail -n 50 /var/log/apache2/error.log , to show the last 50 lines of that file.  The error information should be in the last several lines displayed, and it will tell us what is misconfigured, and if there are typos, or bad directives in all of the apache config files.  This will give us clues as to where to look next.  If there was nothing mistyped, then this should not be an issue, and you should see the correct status for apache2.  Also, you can check /var/log/apache/access.log  for the line: Started LSB: Apache2 web server.

For additional help with configuring Apache2, go to the Apache Documentation.  If you haven’t already gotten your WordPress site up for free on Amazon AWS, sign-up now.  Contact us with questions, or if we can help.

%d bloggers like this: