MOV

3. Production Multi-Container Setup with Docker Compose

📚 Learning Objectives

After completing this exercise, you will be able to:

  • Design and implement a production-grade multi-container architecture
  • Configure nginx as a reverse proxy for PHP-FPM
  • Use Docker Compose to orchestrate multiple containers
  • Implement container networking and service dependencies
  • Apply security best practices for production deployments

🔧 Prerequisites

  • Docker Desktop installed and running
  • Basic understanding of web servers and PHP
  • Completed Exercise 1 (Dockerizing a PHP Web Application)
  • Source files from Exercise 1 (src/ directory with PHP application)

📋 Architecture Overview

In this exercise, we’ll create a production-ready setup with:

»

3. Installing and Configuring phpMyAdmin for MySQL Admin

🎯 Goal

Install and configure phpMyAdmin to provide a web-based graphical interface for managing your MySQL database, making it easier to view data, run queries, and perform database administration tasks.

📋 Prerequisites

Before beginning this tutorial, you should:

  • Have completed Tutorial 1: Manual LEMP Stack Installation
  • Have a working MySQL database with the contact form application
  • Understand basic database concepts (tables, records, queries)
  • Have SSH access to your Ubuntu VM

📚 Learning Objectives

By the end of this tutorial, you will:

»

3. Install PHP and Create a Simple Form Handler

🎯 Goal

Install PHP on your Ubuntu VM and create a simple web application that processes HTML form submissions, demonstrating basic server-side processing with PHP.

📋 Prerequisites

Before beginning this exercise, you should:

  • Have completed the previous VM creation exercises
  • Have an Ubuntu VM running with Nginx installed
  • Be able to SSH into your VM
  • Understand basic HTML form structure

📚 Learning Objectives

By the end of this exercise, you will:

»

3. Creating a Virtual Network with Enhanced Security using Azure CLI

Overview

This exercise will guide you through provisioning a complete solution on Azure using only Azure CLI. The solution comprises three servers: a web server, a reverse proxy, and a bastion host. These components are connected via a virtual network and secured with a Network Security Group (NSG) and Application Security Groups (ASGs).

By the end of this exercise, you will have a working environment with secure, isolated network communication between components.

»

3. Automating Nginx Installation with Custom Data Scripts

Overview

This exercise introduces the use of custom data scripts to automate the installation of Nginx during VM provisioning. You will also edit the default Nginx index page to display custom content.

Step 1: Log in to Azure Portal

  1. Open a web browser and navigate to the Azure Portal.
  2. Sign in using your Azure account credentials.

Step 2: Create a Virtual Machine with Custom Data

  1. Navigate to Virtual Machines in the Azure Portal and click Create > Virtual machine.

    »

4. Deploy Containers to Azure Container Apps

📚 Learning Objectives

After completing this exercise, you will be able to:

  • Deploy containers to Azure Container Apps
  • Use both Azure Portal and Azure CLI for deployment
  • Update running containers with new images
  • Understand the benefits of serverless container hosting
  • Manage container applications without infrastructure complexity

🔧 Prerequisites

  • Azure subscription with credits
  • Azure CLI installed (version 2.37.0 or later)
  • Docker Hub account with your PHP application from Exercise 1
  • Basic understanding of containers

📋 What is Azure Container Apps?

Azure Container Apps is a serverless container hosting service that allows you to:

»

4. SSL/TLS Configuration for Nginx

🎯 Goal

Configure SSL/TLS encryption for your LEMP stack application using Nginx SSL offloading, providing secure HTTPS connections for your web application and phpMyAdmin interface.

📋 Prerequisites

Before beginning this tutorial, you should:

  • Have completed Tutorial 1: Manual LEMP Stack Installation
  • Have a working Nginx web server serving your application
  • Have SSH access to your Ubuntu VM
  • Understand basic concepts of SSL/TLS encryption
  • Recommended: Configure your VM with a static public IP address (see note below)
  • For Part 2 (Let’s Encrypt): Own a registered domain name pointing to your VM’s public IP

⚠️ Important: Static IP Recommendation

»

4. Install the LEMP Stack on an Ubuntu VM Using Azure CLI

Overview

This tutorial explains how to install the LEMP stack (Linux, Nginx, MySQL, PHP) on an Ubuntu Virtual Machine (VM).

Step 1: Provision the Virtual Machine

  1. Create a resource group:

    az group create --name LempRG --location northeurope
    
  2. Provision the Ubuntu VM:

    az vm create \
      --resource-group LempRG \
      --name LempVM \
      --image Ubuntu2204 \
      --size Standard_B1s \
      --admin-username azureuser \
      --generate-ssh-keys
    
  3. Open port 80 for HTTP traffic:

    az vm open-port --resource-group LempRG --name LempVM --port 80
    
  4. Retreive the Public IP of the VM:

    »

4. Creating a Resource Group Using AZ CLI

Overview

This exercise introduces the Azure CLI for managing Azure resources. You will use Azure CLI commands to create a resource group and verify its creation.

Step 1: Log in to Azure Cloud Shell

  1. Open the Azure Portal and click the Cloud Shell icon (top-right corner).
  2. Select Bash as your shell environment if prompted.

💡 Information
The Azure Cloud Shell is a Terminal in the Azure Portal that comes pre-configured with the Azure CLI. It enables you to run CLI commands without additional setup.

»

5. Setting Up a Free Domain with DuckDNS

🎯 Goal

Set up a free subdomain using DuckDNS that points to your Azure VM, enabling you to use Let’s Encrypt SSL certificates and access your application with a memorable domain name instead of an IP address.

📋 Prerequisites

Before beginning this tutorial, you should:

  • Have an Azure VM running with a static public IP address
  • Know your VM’s public IP address
  • Have an email address for account registration
  • Understand basic DNS concepts (A records, domain resolution)

📚 Learning Objectives

By the end of this tutorial, you will:

»