Skip to content

Instantly share code, notes, and snippets.

@ericandrewlewis
Last active August 2, 2025 18:35
Show Gist options
  • Select an option

  • Save ericandrewlewis/95239573dc97c0e86714 to your computer and use it in GitHub Desktop.

Select an option

Save ericandrewlewis/95239573dc97c0e86714 to your computer and use it in GitHub Desktop.

Revisions

  1. ericandrewlewis revised this gist Jun 18, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -317,7 +317,7 @@ for A Record. In the "Value" field, enter the Elastic IP Address created previou
    This resolves traffic to the domain Elastic IP and thereby the EC2 instance.

    If traffic comes in expecting the site under www.{{SITE_DOMAIN}}.com, this traffic should be accepted
    and redirected to a non-"www" version of the URL. Click **Create a Record Set**. Set the "name" to "www.{{SITE_DOMAIN}}.COM". Set the "type" to "CNAME". Set "Value" to "{{SITE_DOMAIN}}.COM}" and save the record set. We'll handle the redirect at the nginx routing layer.
    and redirected to a non-"www" version of the URL. Click **Create a Record Set**. Set the "name" to `www.{{SITE_DOMAIN}}.COM`. Set the "type" to "CNAME". Set "Value" to `{{SITE_DOMAIN}}.COM}` and save the record set. We'll handle the redirect at the nginx routing layer.

    ## Create an SSL certificate

  2. ericandrewlewis revised this gist Jun 18, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -317,7 +317,7 @@ for A Record. In the "Value" field, enter the Elastic IP Address created previou
    This resolves traffic to the domain Elastic IP and thereby the EC2 instance.

    If traffic comes in expecting the site under www.{{SITE_DOMAIN}}.com, this traffic should be accepted
    and redirected to a non-"www" version of the URL. Click **Create a Record Set**. Set the "name" to "www.{{SITE\_DOMAIN}}.COM". Set the "type" to "CNAME". Set "Value" to "{{SITE_DOMAIN}}.COM}" and save the record set. We'll handle the redirect at the nginx routing layer.
    and redirected to a non-"www" version of the URL. Click **Create a Record Set**. Set the "name" to "www.{{SITE_DOMAIN}}.COM". Set the "type" to "CNAME". Set "Value" to "{{SITE_DOMAIN}}.COM}" and save the record set. We'll handle the redirect at the nginx routing layer.

    ## Create an SSL certificate

  3. ericandrewlewis revised this gist Jun 18, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -317,7 +317,7 @@ for A Record. In the "Value" field, enter the Elastic IP Address created previou
    This resolves traffic to the domain Elastic IP and thereby the EC2 instance.

    If traffic comes in expecting the site under www.{{SITE_DOMAIN}}.com, this traffic should be accepted
    and redirected to a non-"www" version of the URL. Click **Create a Record Set**. Set the "name" to "www.{{SITE\_DOMAIN}}.COM". Set the "type" to "CNAME". Set "Value" to "{{SITE\_DOMAIN}}.COM}" and save the record set. We'll handle the redirect at the nginx routing layer.
    and redirected to a non-"www" version of the URL. Click **Create a Record Set**. Set the "name" to "www.{{SITE\_DOMAIN}}.COM". Set the "type" to "CNAME". Set "Value" to "{{SITE_DOMAIN}}.COM}" and save the record set. We'll handle the redirect at the nginx routing layer.

    ## Create an SSL certificate

  4. ericandrewlewis revised this gist Jun 18, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -316,6 +316,9 @@ Now in the context of the new hosted zone, click **Create Record Set**. Ensure t
    for A Record. In the "Value" field, enter the Elastic IP Address created previously.
    This resolves traffic to the domain Elastic IP and thereby the EC2 instance.

    If traffic comes in expecting the site under www.{{SITE_DOMAIN}}.com, this traffic should be accepted
    and redirected to a non-"www" version of the URL. Click **Create a Record Set**. Set the "name" to "www.{{SITE\_DOMAIN}}.COM". Set the "type" to "CNAME". Set "Value" to "{{SITE\_DOMAIN}}.COM}" and save the record set. We'll handle the redirect at the nginx routing layer.

    ## Create an SSL certificate

    Severing your site over HTTPS is an absolute necessity to guarantee your users a basic amount of confidentiality and authenticity.
  5. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.
    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

    If you experience any difficulties or have any feedback, leave a comment. 🐬

  6. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Setting up a WordPress site on Amazon Web Services
    # Setting up a WordPress site on AWS

    This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

  7. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Set up a basic WordPress site on AWS
    # Setting up a WordPress site on Amazon Web Services

    This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

  8. ericandrewlewis revised this gist Jun 17, 2015. No changes.
  9. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Set up a basic WordPress site on AWS

    This tutorial walks through setting up AWS infrastructure for WordPress from the ground up, from creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.
    This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.

  10. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Set up a basic WordPress site on AWS

    This tutorial walks through setting up AWS infrastructure for WordPress from the ground up, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.
    This tutorial walks through setting up AWS infrastructure for WordPress from the ground up, from creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.

  11. ericandrewlewis revised this gist Jun 17, 2015. No changes.
  12. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ This tutorial assumes you're relatively comfortable on the command line and edit

    If you experience any difficulties or have any feedback, leave a comment. 🐬

    Coming soon: I'll be writing another tutorial soon on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.
    Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

    ## About AWS

  13. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ This tutorial assumes you're relatively comfortable on the command line and edit

    If you experience any difficulties or have any feedback, leave a comment. 🐬

    I'll be writing another tutorial soon on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.
    Coming soon: I'll be writing another tutorial soon on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

    ## About AWS

  14. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,8 @@ This tutorial assumes you're relatively comfortable on the command line and edit

    If you experience any difficulties or have any feedback, leave a comment. 🐬

    I'll be writing another tutorial soon on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

    ## About AWS

    [Amazon Web Services (AWS)](http://aws.amazon.com/) offers cloud computing services, including everything necessary to run a WordPress site. This is similar to a web hosting company service, with a few differences:
  15. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ This tutorial walks through setting up AWS infrastructure for WordPress from the

    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.

    If you experience any difficulties or have any feedback, please leave a comment. 🐬
    If you experience any difficulties or have any feedback, leave a comment. 🐬

    ## About AWS

  16. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ This tutorial walks through setting up AWS infrastructure for WordPress from the

    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.

    If you have any difficulties or have any feedback, please leave a comment. 🐬
    If you experience any difficulties or have any feedback, please leave a comment. 🐬

    ## About AWS

  17. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ This tutorial walks through setting up AWS infrastructure for WordPress from the

    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.

    If you experience turbulence during the tutorial or you have any feedback, please leave a comment. 🐬
    If you have any difficulties or have any feedback, please leave a comment. 🐬

    ## About AWS

  18. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ This tutorial walks through setting up AWS infrastructure for WordPress from the

    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.

    If you experience turbulence during the tutorial or you have any feedback, please leave a comment at the bottom. 🐬
    If you experience turbulence during the tutorial or you have any feedback, please leave a comment. 🐬

    ## About AWS

  19. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -507,7 +507,7 @@ Always start Fail2Ban when the system boots.
    sudo chkconfig fail2ban on
    ```
    Fail2Ban comes with configuration for basic services like ssh and MySQL, but not Nginx. [Configure fail2ban for Nginx.](https://rtcamp.com/tutorials/nginx/fail2ban/).
    Fail2Ban comes with configuration for basic services like ssh and MySQL, but not Nginx. [Configure fail2ban for Nginx](https://rtcamp.com/tutorials/nginx/fail2ban/).
    ## Purging Nginx microcache
  20. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -487,7 +487,7 @@ Install the [WordPress Memcached Drop-in](https://wordpress.org/plugins/memcache
    ## Install Fail2Ban
    Fail2Ban watches application logs for malicious activity and bans IP addresses from interacting with your server if any mischief is found.
    [Fail2Ban](http://www.fail2ban.org/wiki/index.php/Main_Page) watches application logs for malicious activity and bans IP addresses from interacting with your server if any mischief is found. This will protect you from brute force attacks.
    Install the Fail2ban.
  21. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,9 @@

    This tutorial walks through setting up AWS infrastructure for WordPress from the ground up, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

    This tutorial is relatively advanced. You should feel comfortable on the command line and editing system configuration files.
    This tutorial assumes you're relatively comfortable on the command line and editing system configuration files.

    If you experience turbulence during the tutorial or you have any feedback, please leave a comment at the bottom. 🐬

    ## About AWS

  22. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Set up a basic WordPress site on AWS

    This tutorial walks through setting up AWS infrastructure from the absolute ground up, starting from setting up an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.
    This tutorial walks through setting up AWS infrastructure for WordPress from the ground up, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

    This tutorial is relatively advanced. You should feel comfortable on the command line and editing system configuration files.

  23. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,3 @@
    *Hey! This guide is in a draft status. I'm making it available for you to try out. It is not production ready.*

    *Please be rad — Run through the entire thing and provide me feedback about your experience via email ([email protected]) or twitter (ericandrewlewis).*

    # Set up a basic WordPress site on AWS

    This tutorial walks through setting up AWS infrastructure from the absolute ground up, starting from setting up an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.
  24. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -452,7 +452,7 @@ At this point the WordPress install is running. There are a few other administra

    ## Install Memcached

    [Memcached](http://memcached.org/) is an object caching system which can be used to speed up request processing on the server with WordPress' Caching API. Read more about [Memcached and WordPress](http://scotty-t.com/2012/01/20/wordpress-memcached/).
    [Memcached](http://memcached.org/) is an object caching system which can be used to speed up PHP script processing by avoiding expensive database queries with WordPress' Caching API. Read more about [Memcached and WordPress](http://scotty-t.com/2012/01/20/wordpress-memcached/).
    Install the Memcached system package.
  25. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,9 @@

    # Set up a basic WordPress site on AWS

    This tutorial walks through setting up AWS infrastructure from the ground up. We'll create a WordPress install on a single EC2 instance (i.e an AWS virtual machine) using Nginx, PHP-FPM, and MySQL.
    This tutorial walks through setting up AWS infrastructure from the absolute ground up, starting from setting up an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

    This tutorial is relatively advanced. You should feel comfortable on the command line and editing configuration files.
    This tutorial is relatively advanced. You should feel comfortable on the command line and editing system configuration files.

    ## About AWS

  26. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -509,4 +509,8 @@ Always start Fail2Ban when the system boots.
    sudo chkconfig fail2ban on
    ```
    Fail2Ban comes with configuration for basic services like ssh and MySQL, but not Nginx. [Configure fail2ban for Nginx.](https://rtcamp.com/tutorials/nginx/fail2ban/).
    Fail2Ban comes with configuration for basic services like ssh and MySQL, but not Nginx. [Configure fail2ban for Nginx.](https://rtcamp.com/tutorials/nginx/fail2ban/).
    ## Purging Nginx microcache
    The Nginx configuration we set stores full-page caches in the microcache for 10 minutes by default. If you edit a post in WordPress, that cache will not be busted automatically. In the same config, we set the cache to purge when a specific HTTP header is sent. Use [this plugin](https://github.com/staylor/scottyandallie/blob/master/wp-content/mu-plugins/cache-purge.php) to hit the cache purge endpoint whenever a post is edited.
  27. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -276,8 +276,6 @@ server {
    }
    ```

    Note that the settings for HTTPS are commented out.

    Create a symlink in the sites-enabled folder to enable the site.

    ```bash
    @@ -290,7 +288,7 @@ Always start Nginx when the system boots.
    sudo chkconfig nginx on
    ```

    We haven't started the Nginx web server, and won't just yet. An SSL certificate for the site's domain needs to be in place first, otherwise we'll encounter a fatal Nginx error.
    We haven't started the Nginx web server, and won't just yet. An SSL certificate for the site's domain needs to be in place first, otherwise we'll encounter a fatal Nginx error when starting Nginx.

    ## Register a domain

  28. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -147,7 +147,7 @@ sudo yum install nginx

    Nginx installs with a basic configuration in `/etc/nginx/`. Overwrite this with more pragmatic defaults from [HTML5 Boilerplate's nginx config](https://github.com/h5bp/server-configs-nginx).

    We'll use git to checkout the H5BP nginx config git repository, so install git first.
    We'll use git to checkout the H5BP nginx config git repository, so we'll install git to do that.

    ```bash
    sudo yum install git
  29. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -147,7 +147,7 @@ sudo yum install nginx

    Nginx installs with a basic configuration in `/etc/nginx/`. Overwrite this with more pragmatic defaults from [HTML5 Boilerplate's nginx config](https://github.com/h5bp/server-configs-nginx).

    We'll use git to checkout the H5BP nginx config repository, so install git first.
    We'll use git to checkout the H5BP nginx config git repository, so install git first.

    ```bash
    sudo yum install git
  30. ericandrewlewis revised this gist Jun 17, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,9 @@

    # Set up a basic WordPress site on AWS

    This tutorial walks through creating a WordPress install on a single EC2 instance (i.e an AWS virtual machine) using Nginx, PHP-FPM, and MySQL.
    This tutorial walks through setting up AWS infrastructure from the ground up. We'll create a WordPress install on a single EC2 instance (i.e an AWS virtual machine) using Nginx, PHP-FPM, and MySQL.

    This tutorial is relatively advanced. You should feel comfortable on the command line and editing configuration files.

    ## About AWS