Categories: CMSLinuxopen source

Complete Guide to WordPress installation on AWS with Docker-Compose

What is WordPress?

Imagine a blank canvas, ready for you to paint your masterpiece. That’s WordPress in a nutshell! It’s a free and open-source platform that lets you build stunning websites without needing to know a single line of code. Think of it as your website’s building block, offering flexibility and power to create anything from a simple blog to a full-fledged online store.

Why is WordPress so popular among non-tech users?

  • User-friendly interface: WordPress boasts a straightforward interface that even a tech newbie can navigate. Drag-and-drop functionality, intuitive menus, and a visual editor make building your website a breeze.
  • Endless customization: With thousands of free and paid themes and plugins, you can tailor your website to your unique vision. Themes control the overall look and feel, while plugins add specific functionalities like contact forms, galleries, and SEO optimization.
  • Supportive community: Stuck on something? No worries! WordPress has a massive and friendly community of users and developers always ready to help. You can find answers to your questions in forums, online tutorials, and even live chat support.

Ready to build your own WordPress website? Let’s dive into the exciting world of cloud hosting with AWS EC2 and Docker Compose!

What is AWS EC2 and Docker Compose?

Think of AWS EC2 as your virtual server in the cloud. It provides the computing power and storage you need to run your website without the hassle of maintaining physical hardware. Docker Compose, on the other hand, is a tool that simplifies the process of setting up and managing multiple software containers on your server.

Installing WordPress on AWS EC2 with Docker Compose:

Here’s a step-by-step guide for non-tech users, using the helpful https://github.com/kashifsaeed79/wordpress-docker-compose repository:

Setting Up Your AWS EC2 Instance

  • Create an AWS account: Head over to https://aws.amazon.com/ and sign up for a free tier account if you’re just starting.
  • Launch an EC2 instance: Choose a suitable Amazon Machine Image (AMI) like Ubuntu Server. This will be your virtual server in the cloud.
  • Connect to your instance: Use a secure shell (SSH) client like PuTTY to connect to your instance remotely.

Installing Docker and Docker Compose

  • Update your package list: Run sudo apt update to ensure you have the latest software versions.
  • Install Docker: Follow the official installation instructions for your chosen operating system (e.g., Ubuntu).
  • Install Docker Compose: Download the latest version from https://docs.docker.com/compose/install/ and extract it to a convenient location.
  • MyScript: here is my script to install docker and docker compose
## Just copy and paste this below code in Ubuntu terminal and press enter

apt update && 
apt upgrade -y &&
curl -fsSL https://get.docker.com -o get-docker.sh &&
sudo sh get-docker.sh &&
curl -SL https://github.com/docker/compose/releases/download/v2.13.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose &&
chmod +x /usr/local/bin/docker-compose &&
apt-get install docker-compose-plugin

Cloning the WordPress Docker Compose Repository

  • Open a terminal: Navigate to your desired directory and clone the git repository . This will download the necessary files for setting up your WordPress environment.
git clone https://github.com/kashifsaeed79/wordpress-docker-compose
cd wordpress-docker-compose

Configuring Your WordPress Environment

  • Copy the example environment file: Run cp env.example .env to create a working environment file.
  • Edit the .env file: Update the following values according to your needs:
    • MYSQL_ROOT_PASSWORD: Set a strong password for your MySQL database.
    • WORDPRESS_DB_NAME: Choose a name for your WordPress database.
  • Start the WordPress containers: Run docker-compose up -d in your terminal. This will start the necessary containers for your WordPress installation.
cp env.example .envnano .env

## after changing in .env file close it by pressing ctrl + X >> Y >> Enter
## Run
docker-compose up -d

Accessing Your WordPress Website

  • Open your web browser: Navigate to the IP address of your EC2 instance with port 8080. http://<server-ip>:8080
  • Log in to your WordPress dashboard: Use the username admin and the password you set during the installation process.

Congratulations! You’ve successfully installed WordPress on your AWS EC2 instance using Docker Compose. Now, let’s add an extra layer of security with an SSL certificate.

Securing Your Website with Nginx Proxy Manager:

Nginx Proxy Manager is a user-friendly tool that lets you manage SSL certificates and secure your website traffic. For installation of please follow this blog-post

Access the Nginx Proxy Manager Web-UI

  • Open your web browser: Navigate to the IP address of your EC2 instance followed by :81. This will open the Nginx Proxy Manager web interface.
  • Log in: Use the email admin@example.com and the password is changeme

Create a Proxy Host for Your WordPress Website

  • Click on “Hosts” in the navigation menu.
  • Click on “Add Proxy Host.”
  • Enter the following information in the respective fields:
    • Host Name: The domain name or subdomain you want your website to be accessible through.
    • Scheme: Choose “HTTP.”
    • Forward Hostname / IP : Paste your Server IP or WordPress Container IP
    • Forward Ports; 8080
  • Click on “Save.”

Request an SSL Certificate

  • Click on “SSL” in the navigation menu.
  • Click on “Let’s Encrypt” tab.
  • Click on “Request SSL Certificate.”
  • Select the domain name you created the proxy host for.
  • Click on “Request.”

Install the SSL Certificate

  • Wait for the certificate request to be processed. This might take a few minutes.
  • Once the certificate is issued, click on “Install” next to your domain name.

Congratulations! Your WordPress website is now accessible securely through HTTPS with an SSL certificate issued by Let’s Encrypt.

Additional Tips:

  • Remember to update your WordPress DNS records to point to your EC2 instance IP address.
  • Consider setting up automatic backups of your WordPress website and database.
  • Explore the vast library of WordPress themes and plugins to customize your website further.

Video Tutorial:

Confused about setting up your own WordPress? Ditch the dry guides and watch my video tutorial

  • Clear, concise instructions in Urdu/Hindi with English subtitles for everyone.
  • Visual demonstration makes every step crystal clear.
  • Time-saving guide gets you up and running fast.
kash

Recent Posts

How to Install Rallly with Docker Compose

What is Rallly? Rallly is an open-source scheduling and collaboration tool designed to make it…

2 weeks ago

How to Install OpenProject: A Step-by-Step Guide for Beginners

Introduction OpenProject is a project management tool designed to help teams organize, collaborate, and track…

2 months ago

Part 2: Jitsi Meet Host Authentication & JWT Token Configuration

Hey there! Welcome back to the website, and today we're diving deeper into Jitsi Meet.…

7 months ago

Self-Hosted Chat: Set Up Your Own Mattermost Server with Ease

Introduction Boost your team's collaboration and productivity with Mattermost, a secure and versatile communication platform.…

9 months ago

How to install n8n in Linux using Docker-Compose

Introduction n8n.io is your secret weapon for workflow automation! It's a user-friendly platform that lets…

10 months ago

How to Install Nextcloud All-in-One on Linux

What is Nextcloud? Nextcloud is an awesome open-source platform that gives you exactly that. Think…

11 months ago