Skip to content

Instantly share code, notes, and snippets.

@budiantoip
budiantoip / How to Setup SFTP.md
Last active April 16, 2025 07:50
How to Setup SFTP

1. How to Setup SFTP

Let's assume the ssh username is dev

Open sshd_config

vim /etc/ssh/sshd_config

Then add

@budiantoip
budiantoip / How to install Cloudflare WARP to an Ubuntu server.md
Last active March 28, 2025 09:23
How to install Cloudflare WARP to an Ubuntu server

Installation

curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ jammy main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update && sudo apt-get install -y cloudflare-warp

Configuration

  1. Run this command:
@budiantoip
budiantoip / Nginx Security Headers.md
Last active March 9, 2025 15:33
Nginx Security Headers

# Prevent MIME-type sniffing
add_header X-Content-Type-Options nosniff always;

# Enforce HTTPS for 1 year + subdomains
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

# Protect against clickjacking attacks
add_header X-Frame-Options SAMEORIGIN always;

# Prevent Cross-site scripting (XSS)

@budiantoip
budiantoip / Upgrade OpenSSH Server on Ubuntu.md
Last active March 7, 2025 09:54
Upgrade OpenSSH Server on Ubuntu
@budiantoip
budiantoip / How to install Older PHP Versions on Ubuntu.md
Last active December 23, 2024 06:08
How to install Older PHP Versions on Ubuntu

Add ondrej/php repository

sudo add-apt-repository ppa:ondrej/php

Update apt metadata

sudo apt update
@budiantoip
budiantoip / Ubuntu Package Upgrades via Cron.md
Created December 2, 2024 20:52
Ubuntu Package Upgrades via Cron

Create a bash script to gracefully reboot the Ubuntu server upon package upgrades

  1. Login as root
  2. Create a bash script file
    vim /root/check-reboot.sh
    
  3. And put these:
    #!/bin/bash
    
@budiantoip
budiantoip / Plesk Cheatsheet.md
Last active November 29, 2024 10:09
Plesk Cheatsheet

HTTP2 Support

Enable

plesk bin http2_pref enable

Disable

plesk bin http2_pref disable
@budiantoip
budiantoip / nginx_snippets.md
Created November 25, 2024 03:09
Nginx snippets

Implement rate-limiting rule for non asset-file requests

# Define the rate limit zone
limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;

server {
    # Exclude CSS, JS, and image files from rate limiting
    location ~* \.(css|js|jpg|jpeg|png|gif|webp|svg|ico)$ {
        # No rate limiting applied for these file types
 # You can put other configurations here if necessary
@budiantoip
budiantoip / monit.md
Last active December 13, 2024 00:13
Monit

How to set up monit on domain.com

vim /etc/monit/monitrc

set daemon  30

set mailserver smtp.gmail.com port 587              # primary mailserver
username "[email protected]" password "my_password"
using tls
with timeout 30 seconds
@budiantoip
budiantoip / How to update PHP version on CentOS 7.md
Created August 3, 2024 04:42
How to update PHP version on CentOS 7
sudo yum install yum-utils -y
sudo yum-config-manager --disable remi-php74
sudo yum-config-manager --enable remi-php82
sudo yum install php php-cli php-fpm php-json php-common php-mysqlnd php-xml php-gd php-mbstring php-intl php-opcache -y