LAMP Deployment Overview¶
Prerequisites¶
To ensure successful deployment, the following conditions must be met:
-
Operating System: Ubuntu or Debian.
-
Access Rights: A user with
rootprivileges. -
Ports:
-
Port
80(HTTP) and port443(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:
-
Installation of system packages
Apache,MariaDB, andPHP. -
Configuration of Apache to run on internal port
8080with support forX-Forwarded-Protoheaders. -
Deployment of the Nginx + Certbot container via Docker Compose to provide SSL certificates.
Access Rights and Security¶
-
Firewall: Ports
80and443must 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 port8080to 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
rootaccount 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
hostnetwork 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:
CERTBOT_EMAIL:[email protected](or value from settings).
-
Restart Policy:
unless-stopped.
Application Update Instructions¶
Updates are performed via pull and container restart:
Permissions Settings¶
The following permissions are used for directories:
-
/root/nginx: ownerroot, grouproot, mode0755. -
Configuration files in
/data/nginx/user_conf.d/: ownerroot, grouproot, mode0644.
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:
Stop:
Reload Nginx configuration without stopping the container: