gc5c175ec8a3cc8ea24b54940f2b1c1c69689485b69e04297753eb85df15bbecd7a5ccde74b348e3b93d8a3910091578aae2a85abd9049bdc19fb4b23dba98057_1280-5017973.jpg

How to Set Up a Free Blog on WordPress and AWS EC2 Using Ubuntu and Docker

Introduction

In the digital age, a photographer’s online presence is as crucial as their camera equipment. A self-hosted blog provides photographers with a platform to showcase their portfolio, share their expertise, and engage with a broader audience. Unlike social media platforms, a self-hosted blog offers full control over content and design, allowing photographers to create a unique and professional online identity.

This guide is designed to help photographers set up a free WordPress blog on AWS EC2 using Ubuntu and Docker. By leveraging the power of AWS and the efficiency of Docker, you can create a scalable, customizable, and cost-effective platform to display your work and connect with potential clients.

Overview

Here’s a quick summary of the steps you’ll follow to set up your blog:

  1. Set Up an AWS Account: Sign up for AWS and explore the benefits of the AWS Free Tier.
  2. Launch an EC2 Instance: Create an EC2 instance using the t2.micro type with Ubuntu as the operating system.
  3. Connect to Your EC2 Instance: Use SSH to connect to your instance and prepare it for software installation.
  4. Install Docker on Ubuntu: Set up Docker on your instance to streamline the deployment of your WordPress site.
  5. Set Up WordPress with Docker: Create and configure Docker containers for MySQL and WordPress.
  6. Configure WordPress: Complete the WordPress installation through the web interface.
  7. Secure Your Instance: Ensure your instance is secure by managing firewall rules and keeping your software updated.

By the end of this guide, you will have a fully functional WordPress blog hosted on AWS, providing you with a robust platform to showcase your photography skills and build your online presence.

Step 1: Set Up an AWS Account

  • Sign Up for AWS
  • Visit the AWS Website: Go to the AWS website.
  • Create an Account:
    • Click on the “Create an AWS Account” button.
    • Enter your email address and choose a password. Then, click “Continue”.
    • Enter your account information, including your name and contact details.
  • Payment Information:
    • Enter your credit or debit card details. Note that while the AWS Free Tier offers many services for free, a payment method is required to verify your identity.
    • You won’t be charged as long as you stay within the free tier limits.
  • Identity Verification:
    • Complete the phone verification by entering your phone number and the verification code sent to you.
  • Select a Support Plan:
    • Choose the “Basic Plan” which is free.
  • Complete Sign-Up:
    • Review your details and complete the sign-up process. You’ll receive a confirmation email once your account is created.
  • Explore the Free Tier
  • What is the AWS Free Tier?
    • The AWS Free Tier provides free usage of various AWS services for new customers for 12 months. This allows you to explore AWS services without incurring costs.
  • Benefits for Your Blog Setup:
    • EC2 Instances: Run a t2.micro instance for free, which is suitable for hosting a small WordPress blog.
    • Storage: Utilize 30 GB of Amazon EBS storage.
    • Database: Use Amazon RDS with limited capacity for relational database management.
    • Additional Services: Access other free services like S3 for storage, Lambda for serverless computing, and CloudFront for content delivery.
  • By leveraging the AWS Free Tier, you can set up and run your WordPress blog without any initial costs, making it an excellent choice for photographers looking to establish their online presence affordably.

Step 2: Launch an EC2 Instance

  • Navigate to EC2
  • Log In to AWS Management Console: Sign in to your AWS account at the AWS Management Console.
  • Find EC2 Service: In the AWS Management Console, find the “Services” menu at the top. Click on it and select “EC2” under the “Compute” section.
  • Launch a New Instance
  • Launch Instance:
    • In the EC2 Dashboard, click the “Launch Instance” button.
  • Choose an Amazon Machine Image (AMI):
    • Select the “Ubuntu Server 20.04 LTS (HVM), SSD Volume Type” AMI from the list. This is a popular choice for its stability and support.
  • Select an Instance Type:
    • Choose the t2.micro instance type, which is free-tier eligible and sufficient for a small WordPress blog.
    • Click “Next: Configure Instance Details”.
  • Configure Instance Details:
    • Use the default settings in this section.
    • Ensure that “Auto-assign Public IP” is enabled to get a public IP address for your instance.
    • Click “Next: Add Storage”.
  • Add Storage:
    • The default storage size is 8 GB, which is usually sufficient. You can increase this if you expect to need more storage.
    • Click “Next: Add Tags”.
  • Add Tags:
    • Adding tags is optional, but it can help you organize and manage your instances. Click “Add Tag” and enter a Key (e.g., “Name”) and a Value (e.g., “MyWordPressBlog”).
    • Click “Next: Configure Security Group”.
  • Configure Security Group:
    • Create a new security group and name it (e.g., “WordPress-SG”).
    • Add the following rules to allow traffic:
      • Type: SSH, Protocol: TCP, Port Range: 22, Source: Anywhere (0.0.0.0/0)
      • Type: HTTP, Protocol: TCP, Port Range: 80, Source: Anywhere (0.0.0.0/0)
    • Click “Review and Launch”.
  • Launch the Instance:
    • Review your instance settings and click “Launch”.
    • You will be prompted to select an existing key pair or create a new one. Choose “Create a new key pair”, name it, and download the key pair file (.pem). Keep this file secure as it is needed to access your instance.
    • Click “Launch Instances”.
  • Finalizing the Launch
  • View Instances: Click “View Instances” to go back to the EC2 Dashboard.
  • Wait for Initialization: Your instance will take a few minutes to initialize. Once the status check shows “2/2 checks passed”, your instance is ready to use.
  • Note the Public IP: Locate your instance’s public IP address in the “Description” tab. You will use this IP to connect to your instance and set up WordPress.
  • By following these steps, you have successfully launched an EC2 instance with Ubuntu, setting the foundation for your WordPress blog.

Step 3: Connect to Your EC2 Instance

  • Obtain Connection Details
  • Navigate to EC2 Dashboard: Go to the AWS Management Console and log in.
  • View Instances: Click on the “Services” menu at the top, select “EC2” under “Compute”, and then click “Instances” in the left-hand menu.
  • Select Your Instance: Find and select the instance you just launched.
  • Find Public DNS: In the “Description” tab at the bottom of the page, locate the “Public DNS (IPv4)” field. This will be in the form of ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com.
  • Connect via SSH
  • Prepare the Key Pair File:
    • Ensure the key pair file (.pem) you downloaded during instance creation is accessible on your local machine.
    • Change the file permissions to make it readable only by you. Open a terminal and run:bashCopy codechmod 400 /path/to/your-key-pair.pem
  • SSH Command:
    • Use the following SSH command to connect to your instance. Replace your-key-pair.pem with the path to your key pair file and ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com with your instance’s public DNS.bashCopy codessh -i /path/to/your-key-pair.pem ubuntu@ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com
  • Execute the SSH Command:
    • Open a terminal (or command prompt on Windows) and enter the SSH command.
    • Example command:bashCopy codessh -i /Users/yourusername/Downloads/my-key-pair.pem ubuntu@ec2-3-12-34-56.compute-1.amazonaws.com
  • Accept the Connection:
    • The first time you connect, you may see a message asking if you want to continue connecting. Type yes and press Enter.
    • You should now be connected to your EC2 instance and see a command prompt like ubuntu@ip-xxx-xx-xx-xx:~$.
  • Troubleshooting Tips:
    • Permission Denied Error: Ensure that the .pem file has the correct permissions using chmod 400.
    • Connection Timeout: Verify that your security group allows SSH traffic (port 22) from your IP address.
    • Incorrect Username: Make sure you are using ubuntu as the username, as this is the default for Ubuntu AMIs.
    • You are now connected to your EC2 instance via SSH. Next, you’ll set up Docker to deploy WordPress.

Step 4: Install Docker on Ubuntu

  • Installing Docker on your Ubuntu EC2 instance is straightforward. Follow these steps:
  • Update the Package List
    • It’s important to ensure that your package list is up-to-date before installing new software. Run the following command:bashCopy codesudo apt update
  • Install Docker
    • Install Docker using the package manager:bashCopy codesudo apt install docker.io
  • Start and Enable Docker
    • Start the Docker service:bashCopy codesudo systemctl start docker
    • Enable Docker to start at boot:bashCopy codesudo systemctl enable docker
  • Verify Docker Installation
    • Check the Docker version to confirm it is installed correctly:bashCopy codedocker --version
    • You should see an output similar to:bashCopy codeDocker version 20.10.12, build e91ed57
  • Add Your User to the Docker Group
    • To run Docker commands without sudo, add your user to the Docker group:bashCopy codesudo usermod -aG docker $USER
    • Log out and log back in so that the group membership is re-evaluated, or you can use the following command to apply the new group membership:bashCopy codenewgrp docker
  • Test Docker Installation
    • Run a test container to ensure Docker is working correctly:bashCopy codedocker run hello-world
    • If Docker is installed correctly, you should see a message saying “Hello from Docker!”
  • Troubleshooting Tips:
    • Permission Issues: If you encounter permission issues when running Docker commands without sudo, make sure you have logged out and logged back in after adding your user to the Docker group.
    • Service Not Starting: If Docker does not start, check the status and logs using:bashCopy codesudo systemctl status docker sudo journalctl -u docker
    • With Docker installed and running on your Ubuntu EC2 instance, you’re ready to move on to setting up WordPress using Docker containers.

Step 5: Set Up WordPress with Docker

  • Now that Docker is installed on your Ubuntu EC2 instance, you can set up WordPress using Docker containers. Follow these steps:
  • Create a Docker Network
    • Docker containers need to communicate with each other. Create a Docker network for WordPress and MySQL containers to communicate:bashCopy codesudo docker network create wordpress-network
  • Run MySQL Container
    • Start a MySQL container with a specified network (wordpress-network), database name, user, and password:bashCopy codesudo docker run --name wordpressdb --network wordpress-network \ -e MYSQL_ROOT_PASSWORD=rootpassword \ -e MYSQL_DATABASE=wordpress \ -e MYSQL_USER=wordpressuser \ -e MYSQL_PASSWORD=wordpresspass \ -d mysql:5.7
    • Replace rootpassword, wordpress, wordpressuser, and wordpresspass with your preferred values for the MySQL root password, database name, user, and password.
  • Run WordPress Container
    • Start a WordPress container linked to the MySQL container:bashCopy codesudo docker run --name wordpress --network wordpress-network \ -p 80:80 \ -e WORDPRESS_DB_HOST=wordpressdb:3306 \ -e WORDPRESS_DB_USER=wordpressuser \ -e WORDPRESS_DB_PASSWORD=wordpresspass \ -e WORDPRESS_DB_NAME=wordpress \ -d wordpress
    • This command runs a WordPress container, linking it to the MySQL container using the wordpress-network. It exposes the WordPress site on port 80 (-p 80:80).
  • Access WordPress Setup
    • Open a web browser and navigate to your EC2 instance’s public IP address or public DNS name (e.g., http://your-ec2-public-ip). You should see the WordPress setup page.
    • Complete the setup by entering your site details, such as site title, username, password, and email address.
  • Complete WordPress Installation
    • Follow the on-screen instructions to complete the WordPress installation.
    • Once done, you’ll have a fully functional WordPress blog running on your AWS EC2 instance, managed by Docker containers.
  • Notes:
    • Persistence: Data in the MySQL database and uploaded media in WordPress will persist as long as the Docker containers are running.
    • Security: Ensure your AWS security group allows inbound HTTP (port 80) traffic for public access to your WordPress site.
  • By following these steps, you have successfully set up WordPress on your AWS EC2 instance using Docker containers, providing a scalable and manageable platform for your photography blog.

Step 6: Configure WordPress

  • Once you have set up WordPress using Docker on your AWS EC2 instance, follow these steps to configure WordPress:
  • Access WordPress
  • Navigate to Your Instance’s Public IP Address
    • Open a web browser on your computer.
    • Enter your EC2 instance’s public IP address or public DNS name in the address bar.
      • Example: http://your-ec2-public-ip
  • Complete Installation
  • Complete the WordPress SetupOnce you access your EC2 instance’s public IP address, you will see the WordPress installation setup screen. Follow these steps to complete the installation:
    • Select Language: Choose your preferred language for the WordPress installation and click “Continue”.
    • WordPress Information: Enter the following details:
      • Site Title: Enter a title for your photography blog.
      • Username: Choose a username for logging into your WordPress dashboard.
      • Password: Create a secure password for your WordPress account.
      • Your Email: Enter your email address.
    • Search Engine Visibility: Optionally, you can check or uncheck the box to discourage search engines from indexing your site during setup.
    • Install WordPress: Click the “Install WordPress” button to initiate the installation process.
    • Login: Once installation is complete, you will be prompted to log in to your new WordPress site. Enter the username and password you set up earlier.
  • Access Your WordPress Dashboard
    • After logging in, you will be redirected to the WordPress dashboard (http://your-ec2-public-ip/wp-admin/).
    • Here, you can start customizing your photography blog, uploading photos, installing themes and plugins, and creating content.
  • Notes:
    • Security: Ensure your WordPress site is secure by regularly updating WordPress core, themes, and plugins. Consider using security plugins and following best practices for WordPress security.
    • Backup: Implement a backup strategy for your WordPress site and database to prevent data loss.
  • By completing these steps, you have successfully configured WordPress on your AWS EC2 instance, allowing you to showcase your photography and engage with your audience through your blog.

Step 7: Secure Your Instance

  • Update Firewall Rules
  • Access Security Groups
    • Go to the AWS Management Console and log in.
    • Navigate to the EC2 Dashboard.
    • Click on “Security Groups” in the left-hand menu.
  • Modify Security Group
    • Select the security group associated with your EC2 instance (e.g., WordPress-SG).
    • Click on the “Inbound rules” tab.
  • Configure Firewall Rules
    • Review and update inbound rules to allow only necessary traffic:
      • SSH (Port 22): Limit SSH access to trusted IP addresses or your specific IP range (e.g., YourIP/32 for a single IP address).
      • HTTP (Port 80): Allow inbound traffic from 0.0.0.0/0 (anywhere) to access your WordPress site over HTTP.
      • HTTPS (Port 443): If you plan to use HTTPS, configure a rule for HTTPS traffic.
    • Delete any unnecessary rules that expose additional ports or services.
  • Apply Changes
    • Click “Save rules” to apply the updated firewall rules.
  • Regular Maintenance
  • Update Instance and Docker
    • Instance Updates:
      • Regularly update the Ubuntu operating system on your EC2 instance to patch security vulnerabilities and bugs:bashCopy codesudo apt update sudo apt upgrade
    • Docker Updates:
      • Keep Docker and its dependencies up to date to benefit from security fixes and new features:bashCopy codesudo apt update sudo apt install docker-ce
  • Monitor Docker Containers
    • Regularly monitor Docker containers for vulnerabilities and updates.
    • Update Docker images used for WordPress (wordpress and mysql in this case) to the latest versions:bashCopy codesudo docker pull wordpress sudo docker pull mysql:5.7
  • Automate Updates
    • Consider setting up automatic updates for your instance and Docker containers using tools like unattended-upgrades for Ubuntu and Docker’s own update mechanisms.
  • Backup Your Data
    • Implement regular backups of your WordPress site and database. Consider using AWS services like Amazon EBS snapshots or third-party backup solutions.
  • Monitor Security Advisories
    • Stay informed about security advisories and vulnerabilities related to Ubuntu, Docker, and WordPress. Subscribe to security mailing lists or follow trusted sources to receive timely updates.
  • By following these security practices and maintaining your AWS EC2 instance and Docker containers regularly, you can significantly reduce the risk of security breaches and ensure your photography blog remains secure and stable.

Benefits for Photographers

  • Control and Customization
    • Full Control: With a self-hosted WordPress blog on AWS EC2, photographers have complete control over customization, themes, plugins, and functionality. This allows for a unique and tailored online presence that reflects their artistic style and branding.
  • Cost-Effectiveness
    • AWS Free Tier: Utilizing AWS Free Tier for hosting on EC2 with Docker containers provides a cost-effective solution. It allows photographers to experiment and run their blogs without upfront costs, benefiting from AWS infrastructure and scaling options as their audience grows.
    • Docker Efficiency: Docker’s containerization minimizes resource usage and allows efficient deployment and scaling of applications, optimizing costs for hosting resources.
  • Performance and Reliability
    • Fast Loading Times: AWS infrastructure ensures high performance and fast loading times, crucial for showcasing high-resolution images and maintaining visitor engagement.
    • Reliability: AWS’s robust infrastructure and Docker’s container management ensure reliable uptime and minimal downtime, essential for maintaining an accessible portfolio and blog.
    • Professional Portfolio
    • Showcase Work: A photography blog serves as a professional portfolio, showcasing high-quality images, projects, and client work in an organized and visually appealing manner.
  • SEO and Brand Building
    • SEO Benefits: With WordPress, photographers can optimize their blog for search engines, improving discoverability and attracting organic traffic through techniques like image SEO, meta tags, and content optimization.
    • Personal Branding: A blog allows photographers to build a personal brand, establishing credibility in their niche, sharing insights, and connecting with a broader audience interested in photography and related topics.
  • Engagement and Interaction
  • Audience Interaction: Blogs facilitate direct interaction with visitors through comments, social media sharing, and engagement metrics. This fosters a community around the photographer’s work and enhances brand loyalty.
  • Learning and Growth
    • Technical Skills Development: Setting up and managing a WordPress blog on AWS with Docker enhances technical skills in server management, containerization, and cloud computing—a valuable asset for photographers looking to expand their digital presence.
    • Creative Growth: Regularly updating and maintaining a blog encourages photographers to create new content, explore new techniques, and share insights, fostering continuous creative growth and development.
  • By leveraging AWS Free Tier and Docker containers for WordPress hosting, photographers not only achieve cost-efficient and scalable infrastructure but also gain robust control over customization, performance, and audience engagement—all essential for establishing a professional online presence in photography.

Conclusion

  • In this guide, we’ve explored how photographers can set up a professional photography blog on AWS using Docker containers. Let’s recap the key steps and benefits:
  • Recap
  • Setup Process: We walked through setting up an AWS EC2 instance, installing Docker, and deploying WordPress for a customizable and scalable blog platform.
  • Benefits: You can enjoy full control over your blog’s customization, cost-effectiveness with AWS Free Tier and Docker, enhanced performance and reliability, and the opportunity to showcase your portfolio professionally.
  • Encouragement
  • Now, it’s your turn to take action and set up your own photography blog:
  • Start Today: Follow the steps outlined in this guide to establish your photography blog on AWS.
  • Explore and Customize: Use the flexibility of WordPress and Docker to tailor your blog to your unique style and needs.
  • Engage and Grow: Engage with your audience, share your passion for photography, and grow your online presence as a professional photographer.
  • I invite you to share your experiences, ask questions, or provide feedback in the comments below. Let’s build a community where photographers can support and learn from each other on their journey to creating impactful photography blogs. Happy blogging!

Additional Resources

  • Links
  • AWS Documentation – Official AWS documentation for learning more about AWS services, including EC2 and networking.
  • Docker Documentation – Official Docker documentation for understanding Docker containers, installation guides, and best practices.
  • Tools and Plugins
  • Useful Tools:
    • WP Super Cache – Enhances website speed and performance by generating static HTML files.
    • Yoast SEO – Optimizes your WordPress site for search engines, helping to improve SEO rankings.
    • Smush – Automatically compresses images to speed up your site without sacrificing quality.
    • UpdraftPlus – Backup your WordPress site to ensure data security and quick restoration if needed.
  • Essential Plugins:
    • Jetpack by WordPress.com – Provides essential features for security, performance, and site management.
    • Akismet Anti-Spam – Protects your blog from spam comments and malicious content.
    • Elementor – A powerful page builder plugin for designing custom pages and layouts without coding.
  • These resources and plugins will help you optimize, secure, and customize your photography blog effectively on AWS using Docker and WordPress. Explore them to enhance your blog’s functionality and user experience.

About the Author

  • Gaurav has been immersed in the world of photography and web technologies for over three decades. With a passion for capturing moments and exploring the intersection of artistry and technology, Gaurav has honed his skills not only behind the camera but also in leveraging digital platforms to showcase his work and teach others.

Leave a Reply

Your email address will not be published. Required fields are marked *