This script performs the following tasks:
- Updates and upgrades the system packages.
- Logs the execution details for debugging and auditing.
- Installs and configures:
- Nginx as the web server.
- PHP and its required extensions.
- Ensures Apache is disabled and stopped to avoid conflicts with Nginx.
- Downloads and sets up WordPress in
/var/www/html
. - Updates the
wp-config.php
file with:- Generated credentials (database name, username, password).
- Security salts fetched dynamically.
- Creates an A record for the domain using the Cloudflare API.
- Ensures Nginx is configured for the specified domain and reloads the configuration.
- Installs Certbot and configures SSL for the domain using the Certbot Nginx plugin.
This script performs the following tasks:
- Installs MariaDB server and client packages.
- Configures MariaDB to listen on all interfaces.
- Creates a new WordPress database, user, and grants privileges.
- Generates a random database username and password.
- Stores credentials securely in a local
creds.txt
file. - Uploads
creds.txt
to an AWS S3 bucket.
- Includes instructions for creating an IAM role for EC2 instances with S3 access.
-
Ubuntu Server
- Recommended: Ubuntu 20.04 or later.
-
Cloudflare Account
- Zone ID and API key for DNS management.
-
AWS S3 Bucket
- For securely storing database credentials.
-
Domain Name
- Pointed to the server's IP address.
-
IAM Role (Optional)
- Attach to the EC2 instance for secure S3 access.
lemp-setup.sh
: Sets up the LEMP stack and deploys WordPress.mariadb-setup.sh
: Configures MariaDB and manages database credentials.configs/
: Contains additional configuration files (e.g., Nginx).
Execution logs are saved to /var/log/script_execution.log
.
- Implement enhanced error handling.
- Add support for additional hosting providers.
- Automate DNS configuration for other DNS providers.