Skip to content

Instantly share code, notes, and snippets.

@budiantoip
budiantoip / How to compile php 8.3.20 on CentOS 7.md
Last active June 12, 2025 22:18
How to compile php 8.3.20 on CentOS 7

Compile PHP 8.3.20 along with all required extensions

#!/bin/bash

sudo su

yum groupinstall -y "Development Tools"
yum install -y epel-release
yum install -y gcc gcc-c++ make autoconf bison re2c libxml2-devel bzip2-devel curl-devel \
    libpng-devel libjpeg-devel libXpm-devel freetype-devel gmp-devel mariadb-devel \
@budiantoip
budiantoip / imunify scripts.md
Last active June 26, 2025 01:28
imunify scripts

Get List of Users

This script will get a list of users. Adjust the domain variable as needed.

vim /etc/sysconfig/imunify360/get-users-script.sh
    #!/bin/bash

    # Script to generate user info in JSON format based on UID_MIN and UID_MAX

    # Extract UID_MIN and UID_MAX from /etc/login.defs
    UID_MIN=$(awk '/^UID_MIN/ { print $2 }' /etc/login.defs)
@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 June 10, 2025 23:44
Nginx Security Headers
# Prevent MIME-type sniffing<br>
add_header X-Content-Type-Options nosniff always;

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

# Protect against clickjacking attacks<br>
add_header X-Frame-Options SAMEORIGIN always;
@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 December 24, 2025 20:06
Plesk Cheatsheet

Components

Get the list of all available Plesk components

plesk installer --select-release-current --show-components

Install PHP 8.3

plesk installer add --components php8.3

Remove PHP 7.0

@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