Skip to content

Instantly share code, notes, and snippets.

View ajayfroiden's full-sized avatar

Ajay Kumar Choudhary ajayfroiden

View GitHub Profile
@ajayfroiden
ajayfroiden / install_lemp_ubuntu.sh
Last active February 4, 2025 09:54
Install LEMP
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu 24.04 dev Server
# Run like (without sudo) - bash install_lamp.sh
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive
#!/bin/bash
# Check if Apache is running
if systemctl is-active --quiet apache2; then
echo "Apache is running."
else
echo "Apache is not running. Restarting Apache..."
sudo systemctl restart apache2
echo "Apache has been restarted."
fi
@ajayfroiden
ajayfroiden / database_backup.sh
Last active February 4, 2025 10:06
Database Backup and upload to s3 and delete old backups from local server
#!/bin/bash
# Database Backup Script
# This script performs MySQL database backups and uploads them to AWS S3
# Created: 2024
#
# Prerequisites:
# - MySQL/MariaDB installed
# - AWS CLI configured with appropriate credentials
# - Sufficient permissions on the backup directory
@ajayfroiden
ajayfroiden / example.com.conf
Last active January 22, 2025 06:40
Virtual Host configuration apache example.com
Check comments
@ajayfroiden
ajayfroiden / how-to-secure-apache-with-let-s-encrypt-on-ubuntu
Created January 9, 2025 12:44
Free SSL installation Apache server
sudo apt update
sudo apt install certbot python3-certbot-apache
sudo vim /etc/apache2/sites-available/your_domain.com.conf
sudo apache2ctl configtest
sudo systemctl reload apache2
@ajayfroiden
ajayfroiden / iam-permissions-policy
Created January 7, 2025 12:20
Bucket Permission Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject",
@ajayfroiden
ajayfroiden / install_lamp_ubuntu.sh
Last active February 6, 2025 11:56
Ubuntu 22 - PHP development (8.3, apache 2.4) credits ankurk91
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu 20.04 dev Server
# Run like (without sudo) - bash install_lamp.sh
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive