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
rootprivileges or full access viasudo. -
Ports:
-
Port
80(HTTP) and443(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.
-
Installation of base packages:
-
Apache2 web server is installed.
-
MariaDB database (version 10.11) is installed.
-
PHP version 8.2 (for Ubuntu) or the standard PHP version (for Debian) is installed, including
mysql,curl, andcgimodules. -
Apache Configuration:
-
The web server is reconfigured to listen on port
8080instead of the default80. -
The
remoteipmodule is configured to correctly passX-Forwarded-Protoheaders, allowing the application to recognize that the request arrived via a secure connection (HTTPS). -
Docker and SSL Configuration:
-
Docker runtime is installed.
-
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):
-
Updating the Certbot container: Navigate to the configuration directory and perform a restart:
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_secretsvolume
Available Ports for Connection¶
| Port | Purpose |
|---|---|
443 | External access via HTTPS (via Certbot/Nginx) |
8080 | Internal access to Apache |