Skip to content

LAMP Deployment Overview

Prerequisites

To ensure successful deployment, the following conditions must be met:

  • Operating System: Ubuntu or Debian.

  • Access Rights: A user with root privileges.

  • Ports:

    • Port 80 (HTTP) and port 443 (HTTPS) are reserved for the Certbot/Nginx Docker container.

    • Apache is redirected to internal port 8080.

FQDN of the final panel on hostkey.in domain

The domain template is formed as follows:

Parameter Value
Prefix lamp
Domain hostkey.in
Full Template lamp{Server_ID_from_Invapi}.hostkey.in

File and Directory Structure

Main directories used in the system:

  • /root/nginx — working directory for Docker Compose.

  • /data/nginx/user_conf.d — directory containing Nginx user configurations.

  • /data/nginx/nginx-certbot.env — environment variables file for the container.

Application Installation Process

Deployment includes installing the classic LAMP stack (Linux, Apache, MariaDB, PHP) and configuring proxying via Docker:

  1. Installation of system packages Apache, MariaDB, and PHP.

  2. Configuration of Apache to run on internal port 8080 with support for X-Forwarded-Proto headers.

  3. Deployment of the Nginx + Certbot container via Docker Compose to provide SSL certificates.

Access Rights and Security

  • Firewall: Ports 80 and 443 must be open for external traffic.

  • Users: All core processes are executed as root.

  • Restrictions: Apache is configured to listen only on the loopback interface (127.0.0.1) on port 8080 to avoid conflicts with Nginx.

Databases

MariaDB is used as the database management system.

  • Version: 10.11.

  • Storage: Data is stored in standard MariaDB directories (depends on the OS).

  • Settings: The root account uses a password passed via a system environment variable.

Docker Containers and Execution

The system deploys one main container for SSL management and proxying:

Nginx Certbot Container

  • Image Name: jonasal/nginx-certbot:latest

  • Ports: Uses host network mode (listens to host ports directly).

  • Volumes:

    • nginx_secrets:/etc/letsencrypt — certificate storage.

    • /data/nginx/user_conf.d:/etc/nginx/user_conf.d — user configurations.

  • Environment Variables:

  • Restart Policy: unless-stopped.

Application Update Instructions

Updates are performed via pull and container restart:

cd /root/nginx && docker compose pull && docker compose up -d

Permissions Settings

The following permissions are used for directories:

  • /root/nginx: owner root, group root, mode 0755.

  • Configuration files in /data/nginx/user_conf.d/: owner root, group root, mode 0644.

Location of Configuration Files and Data

  • Docker Compose Configuration: /root/nginx/compose.yml

  • Nginx User Configs: /data/nginx/user_conf.d/{prefix}{server_id}.{zone}.conf

  • PHP Info File: /var/www/html/info.php

Available Connection Ports

Port Protocol Purpose
80 HTTP Redirection via Nginx (Certbot)
443 HTTPS Primary application access via SSL
8080 HTTP Internal Apache traffic

Starting and Stopping the Application

Managing the proxy server container:

Start:

cd /root/nginx && docker compose up -d

Stop:

cd /root/nginx && docker compose down

Reload Nginx configuration without stopping the container:

docker compose exec -T nginx nginx -s reload

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×