harbor run -t LiteCoder/deploy-secure-lemp-stackharbor download LiteCoder/deploy-secure-lemp-stackCreate a Bash deployment script that installs and configures a production-ready LEMP stack (Nginx, MariaDB, PHP-FPM) with SSL/TLS, fail2ban, and firewall hardening on an Ubuntu 22.04 system.
/app/deploy.sh (must be executable, chmod +x)/app/verify.sh (must be executable, chmod +x)/app/deployment_report.txt#!/bin/bash shebang/app/deploy.sh)The script must perform the following steps in order:
System Update: Update package lists and upgrade installed packages.
Nginx Installation & Configuration:
/etc/nginx/sites-available/webapp./etc/ssl/certs/webapp.crt and /etc/ssl/private/webapp.key./etc/nginx/sites-enabled/.fastcgi_pass directive pointing to the PHP-FPM socket.server_name to localhost./var/www/webapp.MariaDB Installation & Hardening:
SecureR00tP@ss.webapp_db.webapp_user with password W3bAppUs3r! and grant all privileges on webapp_db.PHP-FPM Installation & Configuration:
php-mysql extension./var/www/webapp/info.php containing exactly <?php phpinfo(); ?>./var/www/webapp/index.php that contains a PHP script which outputs exactly the string LEMP Stack Operational (as plain text)./var/www/webapp to www-data:www-data.UFW Firewall Configuration:
Fail2ban Installation & Configuration:
/etc/fail2ban/jail.local.[sshd] — enabled, maxretry = 3, bantime = 3600[nginx-http-auth] — enabled, maxretry = 3, bantime = 3600Service Management:
Generate Deployment Report:
/app/deployment_report.txt.nginx=installed
mariadb=installed
php-fpm=installed
ufw=active
fail2ban=installed
ssl=configured
firewall_ports=22,80,443
/app/verify.sh)Create a script that checks the deployment and prints results to stdout. It must check and print one line per check in the format CHECK_NAME=PASS or CHECK_NAME=FAIL:
NGINX_INSTALLED — nginx binary existsMARIADB_INSTALLED — mariadb binary existsPHP_FPM_INSTALLED — php-fpm binary or service existsSSL_CERT_EXISTS — /etc/ssl/certs/webapp.crt existsSSL_KEY_EXISTS — /etc/ssl/private/webapp.key existsNGINX_CONFIG_EXISTS — /etc/nginx/sites-available/webapp existsSITE_ENABLED — symlink exists in /etc/nginx/sites-enabled/ for webappDOCUMENT_ROOT_EXISTS — /var/www/webapp directory existsINDEX_PHP_EXISTS — /var/www/webapp/index.php existsINFO_PHP_EXISTS — /var/www/webapp/info.php existsFAIL2BAN_JAIL_EXISTS — /etc/fail2ban/jail.local existsUFW_ENABLED — UFW status shows activeREPORT_EXISTS — /app/deployment_report.txt exists