Skip to content

Deployment Overview of LAMP on Server

Prerequisites and Basic Requirements

The deployment requires a server running Ubuntu with the following specifications: - Operating System: Ubuntu 22.04 (Jammy) - Architecture: AMD64 - Privileges: Root access or sudo privileges are required to install packages and configure services. - Network: The server must have outbound internet access to download packages and repositories. - Ports: Port 80 and 443 must be open for web traffic.

File and Directory Structure

The application and configuration files are organized in the following locations: - Web root directory: /var/www/html - PHP information file: /var/www/html/info.php - Nginx user configuration directory: /data/nginx/user_conf.d - Nginx environment file: /data/nginx/nginx-certbot.env - Let's Encrypt secrets volume mount point: /etc/letsencrypt (mapped from nginx_secrets) - MariaDB GPG key: /usr/share/keyrings/mariadb-keyring.gpg

Application Installation Process

The LAMP stack is installed using the APT package manager with the following components and versions: - Apache: Installed via the apache2 package. - MariaDB: Version 10.11 is installed from the official MariaDB repository. - Packages: mariadb-server, mariadb-client. - Repository: http://mariadb.mirror.globo.tech/repo/10.11/ubuntu jammy main. - PHP: Version 8.2 is installed from the ppa:ondrej/php repository. - Packages: php8.2, libapache2-mod-php8.2, php8.2-mysql, php8.2-curl, php8.2-cgi.

After installation, the Apache service is restarted to apply the PHP module configuration. A test file info.php is created in the web root to verify the PHP installation.

Docker Containers and Their Deployment

A Docker container for Nginx is deployed using the jonasal/nginx-certbot:latest image. The container is configured with the following parameters: - Restart Policy: unless-stopped - Network Mode: host - Environment Variables: - CERTBOT_EMAIL: Set to [email protected] - Additional environment variables are loaded from /data/nginx/nginx-certbot.env - Volumes: - nginx_secrets: An external volume mounted to /etc/letsencrypt for SSL certificates. - /data/nginx/user_conf.d: Mounted to /etc/nginx/user_conf.d for custom Nginx configurations.

The deployment utilizes a Docker Compose configuration file located at compose.yml.

Proxy Servers

Nginx acts as the reverse proxy and handles SSL termination using Let's Encrypt. - Image: jonasal/nginx-certbot:latest - SSL Configuration: Managed automatically by the Certbot integration within the Nginx container. - Custom Domains: Configurations for custom domains are placed in the /data/nginx/user_conf.d directory, which is mounted into the container. - Certificate Storage: SSL certificates are stored in the external volume nginx_secrets, mapped to /etc/letsencrypt inside the container.

Starting, Stopping, and Updating

Service management for the installed components is handled via systemctl: - Apache: - Start: systemctl start apache2 - Stop: systemctl stop apache2 - Restart: systemctl restart apache2 - Status: systemctl status apache2

  • MariaDB:
  • Start: systemctl start mariadb
  • Stop: systemctl stop mariadb
  • Restart: systemctl restart mariadb
  • Status: systemctl status mariadb

  • Docker Containers:

  • Start: docker compose up -d
  • Stop: docker compose down
  • Restart: docker compose restart
  • Update: Pull the latest image using docker pull jonasal/nginx-certbot:latest and restart the container.

Databases

The database server is MariaDB version 10.11. - Connection Method: The application connects to the database using the php8.2-mysql extension. - Storage Location: Database data is stored in the default MariaDB data directory on the host system. - Configuration: Default configuration files are located in /etc/mysql and /etc/mysql/mariadb.conf.d.

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