Skip to content

LAMP Deployment Overview on Server

Prerequisites

To successfully deploy the LAMP stack (Linux, Apache, MariaDB, PHP), the following conditions must be met:

  • Operating System: Ubuntu or Debian.

  • Access Rights: A user with root privileges or full access via sudo.

  • Ports:

  • Port 80 (HTTP) and 443 (HTTPS) must be available for use by the Certbot container.

  • Apache is reconfigured to run on internal port 8080.

FQDN of the final panel on hostkey.in domain

The following domain name template is used to access the web application:

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

Application Installation Process

The deployment process includes installing system components and configuring proxying to provide SSL certificates.

  1. Installation of base packages:

  2. Apache2 web server is installed.

  3. MariaDB database (version 10.11) is installed.

  4. PHP version 8.2 (for Ubuntu) or the standard PHP version (for Debian) is installed, including mysql, curl, and cgi modules.

  5. Apache Configuration:

  6. The web server is reconfigured to listen on port 8080 instead of the default 80.

  7. The remoteip module is configured to correctly pass X-Forwarded-Proto headers, allowing the application to recognize that the request arrived via a secure connection (HTTPS).

  8. Docker and SSL Configuration:

  9. Docker runtime is installed.

  10. A container is deployed for automatic acquisition and renewal of SSL certificates via Certbot.

Docker Containers and Execution

To ensure HTTPS operation, a certificate management container is used:

Parameter Value
Image Name jonasal/nginx-certbot:latest
Restart Policy unless-stopped
Network Mode host
Volumes nginx_secrets:/etc/letsencrypt
/data/nginx/user_conf.d:/etc/nginx/user_conf.d
Environment Variables [email protected]

The container uses the external volume nginx_secrets to store certificates and proxies requests to the local Apache.

Application Update Instructions

To update system components, use the following commands:

  • Updating system packages (Apache, MariaDB, PHP):

    apt update && apt upgrade -y
    

  • Updating the Certbot container: Navigate to the configuration directory and perform a restart:

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

Configuration Files and Data Locations

  • Nginx (Certbot) Configuration: /root/nginx/compose.yml

  • Custom Nginx Configs: /data/nginx/user_conf.d/

  • Certbot Environment Variables: /data/nginx/nginx-certbot.env

  • Logs and Certificates (inside Docker): nginx_secrets volume

Available Ports for Connection

Port Purpose
443 External access via HTTPS (via Certbot/Nginx)
8080 Internal access to Apache
question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×