Skip to content

Instantly share code, notes, and snippets.

View miiiladiii244's full-sized avatar
🏠
Working from home

Milad miiiladiii244

🏠
Working from home
View GitHub Profile
@miiiladiii244
miiiladiii244 / nginx-basic-setup.sh
Created February 21, 2025 17:21
A bash script to setup nginx as reverse proxy to $BACKEND
#!/bin/bash
set -e
# Variable for the backend service address.
BACKEND="127.0.0.1:8000"
# Echo the purpose of this script.
echo "This script installs Nginx, creates a self-signed SSL certificate, and configures Nginx as a reverse proxy to forward HTTPS requests to the backend service at ${BACKEND}."
echo "Updating package index and installing nginx and openssl..."
@miiiladiii244
miiiladiii244 / cloudflare-ufw.sh
Created January 1, 2025 05:14
A bash script to generate and apply required rules in ufw for serving 80 and 443 to only cloudflare servers.
#!/bin/bash
# Fetch Cloudflare IP ranges
ipv4_url="https://www.cloudflare.com/ips-v4"
ipv6_url="https://www.cloudflare.com/ips-v6"
# Temporary files to store IP ranges
ipv4_file="/tmp/cloudflare_ipv4.txt"
ipv6_file="/tmp/cloudflare_ipv6.txt"