AKZN Notes

Archives for My Lazy and Forgetful Mind

Category: VPS

Fix EPrints 3.4.7 cgi HTTPS Redirect Loop (Certbot + Apache)

Fix: EPrints 3.4.7 /cgi HTTPS Redirect Loop (Certbot + Apache) Problem When enabling HTTPS using Certbot, EPrints /cgi endpoints (e.g. /cgi/users/login) return: 302 → same URL (infinite redirect) Main site works, but only /cgi loops. Root Cause Certbot generates its own SSL vhost: /opt/eprints3/cfg/apache/{repoid}-le-ssl.conf However, it omits required EPrints directives, specifically: PerlSetVar EPrints_Secure yes Without […]

Manual Rsync Backup from VPS to Local (with Exclusions)

Rsync Backup from VPS to Local (with Exclusions) Command rsync -avz -e "ssh -p 2222" \ –exclude='node_modules' \ –exclude='vendor' \ –exclude='.env' \ user@vps:/path/app/ /home/youruser/backup/app/ Explanation Basic flags -a → archive mode (preserve permissions, symlinks, etc.) -v → verbose (show progress) -z → compress during transfer (faster over network) -e "ssh -p 2222" → use SSH […]

VPS First-Time Setup

VPS First-Time Setup Assume: New SSH port = 2222 Ubuntu VPS 1. Initial Login ssh root@YOUR_VPS_IP apt update && apt upgrade -y reboot Reconnect after reboot. 2. Create Non-Root User adduser youruser usermod -aG sudo youruser 3. Setup SSH Key (Recommended) From local machine: ssh-keygen ssh-copy-id youruser@YOUR_VPS_IP Test login: ssh youruser@YOUR_VPS_IP Disable root SSH login […]

Setting Persistent IPv4 DNS for Ubuntu 20.xx

Prefer IPv4 for DNS & Connections on Ubuntu (Keep IPv6 Enabled) On Ubuntu 20.04+, systemd-resolved and the network stack prefer IPv6 when it’s available. Even if you set IPv4 DNS, connections may still use IPv6 (AAAA records). This guide keeps IPv6 enabled, but makes Ubuntu prefer IPv4 for DNS and connections. 🎯 Goal Keep IPv6 […]

How to import big table using mysql command on terminal

Understanding the MySQL Import Command with Custom Parameters When importing large SQL dump files into MySQL, it is often necessary to adjust MySQL’s configuration parameters to handle large queries and improve performance. The following command is an example of importing a database dump while customizing MySQL’s memory settings and disabling foreign key checks: "D:\xampp\mysql\bin\mysql" –max_allowed_packet=512M […]

How to Backup VPS to Home Server using BORG

To back up your VPS to your home server using BorgBackup, follow these steps: 1. Install Borg on Both VPS & Home Server On VPS: sudo apt update && sudo apt install borgbackup -y On Home Server: sudo apt update && sudo apt install borgbackup -y 2. Set Up SSH Access (Passwordless Login) On your […]

HTTP Basic Authentication to secure phpMyAdmin

HTTP Authentication is a method of securing web resources by requiring users to provide valid credentials before accessing them. It operates at the HTTP protocol level and can be implemented using several authentication schemes. One common method for HTTP Authentication is Basic Authentication, which prompts users to enter their username and password in a dialog […]

Importing MySQL Gzipped Dump File via Terminal

Importing MySQL Gzipped Dump File via Terminal When dealing with MySQL databases, it’s common to export and import data for various reasons, such as backups or transferring data between environments. In this concise guide, we’ll focus on importing a gzipped MySQL dump file using the terminal on a system running Ubuntu. Step 1: Navigate to […]

How to Set Timezone Permanently on Ubuntu to UTC+7 (Indochina Time, ICT)

Introduction: Setting the correct timezone on your Ubuntu system is crucial for accurate timekeeping and proper synchronization. In this article, we will guide you through the process of permanently setting the timezone to UTC+7 (Indochina Time, ICT) using the timedatectl command. Step 1: Open a Terminal Open a terminal on your Ubuntu system. You can […]

Run two PHP version on same server

Below is a simple Markdown tutorial for configuring Apache to run two PHP versions (PHP 7.4 and PHP 8.0) concurrently using PHP-FPM. This assumes you’re using a Linux system with Apache. Running Multiple PHP Versions with Apache and PHP-FPM before starting, check if we already has two php version sudo update-alternatives –display php Prerequisites Linux […]