Monday, March 2, 2026

How to move servers between AWS regions


Step 1 — Create AMI in Source Region

In AWS console:

EC2 → Instances
Select your instance
Actions → Image and templates → Create Image

Wait until AMI is ready.


Step 2 — Copy AMI to Destination region

Go to:

EC2 → AMIs
Select AMI
Actions → Copy AMI
Destination region → US East (N. Virginia)

Step 3 — Launch new instance

Switch region to N. Virginia

EC2 → AMIs → Launch instance

Your server will start in us-east-1.


Important: IP address will change

You will get a new public IP, which we can  configure it in our DNS.



Friday, February 27, 2026

Allocate swap file, when server RAM GB is low to remove mysql errors

 sudo fallocate -l 2G /swapfile || sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

# optional but recommended
echo 'vm.swappiness=20' | sudo tee /etc/sysctl.d/99-swappiness.conf
sudo sysctl -p /etc/sysctl.d/99-swappiness.conf

free -h
swapon --show

Tuesday, February 10, 2026

cPanel multi-domain hosting for laravel project

 STEP 1 — Create the Subdomain


                    cPanel → Domains → Create A New Domain (or Subdomains)

cPanel will automatically create:

/home/egproject/test.example.com/



STEP 2 — Correct Laravel Folder Structure (Very Important)

/home/egproject/
    test/                             ← FULL Laravel project
   test.example.com/        ← ONLY public folder contents




STEP 3 — Upload Files Properly

1️⃣ Upload full project here:

/home/egproject/test/
         
app/
bootstrap/
config/
database/
public/
resources/
routes/
storage/
vendor/
.env
artisan

2️⃣ Now open:

/home/egproject/test/public/

Copy EVERYTHING inside public folder to:

/home/egproject/test.example.com/

So that folder contains:

index.php
.htaccess
css/
js/
images/

 STEP 4 — Modify index.php (CRITICAL)


/home/egproject/test.example.com/index.php

Change these lines:

FROM:

require __DIR__.'/../vendor/autoload.php'; $app = require_once __DIR__.'/../bootstrap/app.php';

TO:

require __DIR__.'/../test/vendor/autoload.php'; $app = require_once __DIR__.'/../test/bootstrap/app.php';

Because your Laravel core lives in /test.


STEP 5 — Update .env


APP_URL=https://test.example.com
DB_HOST=localhost
DB_DATABASE=egproject_db
DB_USERNAME=egproject_user
DB_PASSWORD=yourpassword

STEP 6 — Permissions (Very Important)

In File Manager:

Set:

test/storage → 755 test/bootstrap/cache → 755

If errors:

chmod -R 775 storage chmod -R 775 bootstrap/cache

STEP 7 — Set up database


    cPanel → Database Manager → Create DB and setup user for that

Thursday, January 29, 2026

How to allow higher MB file uploads by increasing size in server php.ini

1) Check php version using the command:

                            php -v


2) Make sure server is using apache php or php cli by using the below command

                        sudo systemctl status


3) Check if any php-fpm is running. else

            sudo nano  /etc/php/8.4/cli/php.ini


4) Edit php.ini and change these values from 2M to 10 or 20 M

                    upload_max_filesize = 10M 

                    post_max_size = 10M


4. Restart web server:

                    sudo systemctl restart php8.4-fpm

                     sudo systemctl restart apache2

Monday, January 26, 2026

Get Gmail App Password for email notification through laravel app

 

First, you need to create an App Password from your Google Account:

    Go to your Google Account: https://myaccount.google.com/

    Click on "Security" in the left menu

    Enable "2-Step Verification" if not already enabled

    Go back to Security → 2-Step Verification

    Scroll down to "App passwords"

    Select "Mail" and "Other (Custom name)"

    Enter a name like "Laravel App"

    Click "Generate"

    Copy the 16-character password (no spaces)

     

     Update .env file with the following info:

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-16-char-app-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="your-email@gmail.com"
MAIL_FROM_NAME="${APP_NAME}"



     

     

     

     

Friday, January 23, 2026

How to change git origin for repo after making a copy of the repo

 1) Locally  run the following commands for the existing repo:

                        git remote -v

This will help us find the current remote origin

2) Set remote origin to the new repo:

                    git remote set-url origin git@gitlab.com:folder/repo.git

3) Locally ensure that it is in the correct branch

                    git checkout import-main

4) if activities were done in a new branch, merge it with the current branch "import main"

                                                  git merge main

5) push the code to the git


                        git push