Why AWS EC2 Over Shared Hosting?
Full server control for custom configurations
Scalability as your projects grow
Professional credibility with clients
Learning experience with cloud infrastructure
Tech Stack
Backend: Laravel 12
Frontend: Tailwind CSS
Server: Ubuntu 22.04 on AWS EC2 t2.micro
Web Server: Nginx
Database: SQLite (perfect for portfolios)
SSL: Let's Encrypt (free)
Step-by-Step Deployment
1. EC2 Setup
Launch t2.micro instance (free tier)
Configure security groups: HTTP (80), HTTPS (443), SSH (22)
Copy
bash
2. Server Configuration
Update system
sudo apt update && sudo apt upgrade -y
Install PHP 8.3 and extensions
sudo apt install php8.3-fpm php8.3-mysql php8.3-xml php8.3-curl php8.3-zip
Install Nginx
sudo apt install nginx
Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Copy
bash
3. Laravel Deployment
Clone your repository
git clone https://github.com/yourusername/portfolio.git /var/www/portfolio
Install dependencies
cd /var/www/portfolio
composer install --optimize-autoloader --no-dev
Set permissions
sudo chown -R www-data:www-data /var/www/portfolio
sudo chmod -R 755 /var/www/portfolio
sudo chmod -R 775 /var/www/portfolio/storage
Copy
bash
4. Nginx Configuration
server {
listen 80;
server_name yourdomain.com;
root /var/www/portfolio/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}
Copy
nginx
5. SSL with Let's Encrypt
Install Certbot
sudo apt install certbot python3-certbot-nginx
Get SSL certificate
sudo certbot --nginx -d yourdomain.com
Auto-renewal (already configured)
sudo systemctl status certbot.timer
Copy
bash
Auto-Deployment with GitHub Webhooks
Created a webhook endpoint that automatically pulls changes:
Full server control for custom configurations
Scalability as your projects grow
Professional credibility with clients
Learning experience with cloud infrastructure
Tech Stack
Backend: Laravel 12
Frontend: Tailwind CSS
Server: Ubuntu 22.04 on AWS EC2 t2.micro
Web Server: Nginx
Database: SQLite (perfect for portfolios)
SSL: Let's Encrypt (free)
Step-by-Step Deployment
1. EC2 Setup
Launch t2.micro instance (free tier)
Configure security groups: HTTP (80), HTTPS (443), SSH (22)
Copy
bash
2. Server Configuration
Update system
sudo apt update && sudo apt upgrade -y
Install PHP 8.3 and extensions
sudo apt install php8.3-fpm php8.3-mysql php8.3-xml php8.3-curl php8.3-zip
Install Nginx
sudo apt install nginx
Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Copy
bash
3. Laravel Deployment
Clone your repository
git clone https://github.com/yourusername/portfolio.git /var/www/portfolio
Install dependencies
cd /var/www/portfolio
composer install --optimize-autoloader --no-dev
Set permissions
sudo chown -R www-data:www-data /var/www/portfolio
sudo chmod -R 755 /var/www/portfolio
sudo chmod -R 775 /var/www/portfolio/storage
Copy
bash
4. Nginx Configuration
server {
listen 80;
server_name yourdomain.com;
root /var/www/portfolio/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}
Copy
nginx
5. SSL with Let's Encrypt
Install Certbot
sudo apt install certbot python3-certbot-nginx
Get SSL certificate
sudo certbot --nginx -d yourdomain.com
Auto-renewal (already configured)
sudo systemctl status certbot.timer
Copy
bash
Auto-Deployment with GitHub Webhooks
Created a webhook endpoint that automatically pulls changes: