Domain: corepath.live
SSL: Let’s Encrypt
Stack: Apache + MariaDB + PHP
1️⃣ Launch EC2
- Create EC2 instance (Amazon Linux / RHEL)
- Open Security Group ports:
- 22 (SSH)
- 80 (HTTP)
- 443 (HTTPS)
2️⃣ Install Apache
sudo yum update -y
sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
3️⃣ Install MariaDB
sudo yum install mariadb-server -y
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Create Database
sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
4️⃣ Install PHP
sudo yum install -y php php-mysqlnd php-fpm php-json php-gd php-mbstring php-xml php-curl
sudo systemctl restart httpd
5️⃣ Download WordPress
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzf latest.tar.gz
sudo rm -f latest.tar.gz
Set permissions:
sudo chown -R apache:apache /var/www/html/wordpress
sudo find /var/www/html/wordpress -type d -exec chmod 755 {} \;
sudo find /var/www/html/wordpress -type f -exec chmod 644 {} \;
6️⃣ Configure Apache VirtualHost (HTTP)
Create file:
sudo nano /etc/httpd/conf.d/corepath.live.conf
<VirtualHost *:80>
ServerName corepath.live
ServerAlias www.corepath.live
DocumentRoot /var/www/html/wordpress
<Directory /var/www/html/wordpress>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Restart:
sudo systemctl restart httpd
7️⃣ Configure DNS (CRITICAL STEP)
At Hostinger DNS:
- A record →
13.221.85.216 - www → CNAME → corepath.live
- ❌ Delete AAAA (IPv6) record
Verify:
dig A corepath.live +short
dig AAAA corepath.live +short
AAAA must return nothing.
8️⃣ Install SSL (Let’s Encrypt)
sudo yum install certbot python3-certbot-apache -y
sudo certbot --apache -d corepath.live -d www.corepath.live
Choose:
2 (Redirect HTTP → HTTPS)
Certbot automatically created:
/etc/httpd/conf.d/corepath.live-le-ssl.conf
9️⃣ Force HTTP → HTTPS (Manual if needed)
Edit:
sudo nano /etc/httpd/conf.d/corepath.live.conf
<VirtualHost *:80>
ServerName corepath.live
ServerAlias www.corepath.live
Redirect permanent / https://corepath.live/
</VirtualHost>
Restart:
sudo systemctl restart httpd
🔟 Verify
curl -I http://corepath.live
curl -I https://corepath.live
Expected:
- HTTP → 301 redirect
- HTTPS → 200 or 302
✅ Final Result Architecture
User
↓
HTTPS (443)
↓
Apache (SSL via Let's Encrypt)
↓
WordPress (PHP)
↓
MariaDB
🧠 Problems You Solved
✔ DNS IPv6 conflict (AAAA record)
✔ Apache VirtualHost missing
✔ DirectoryIndex issue
✔ PHP not installed
✔ SSL validation failure
✔ HTTP → HTTPS redirect