How to Install WordPress on VPS in Pakistan (Step by Step Guide)

Imagine you’ve got a cozy home for your website—that’s your VPS (Virtual Private Server). Think of it like renting your own private room in a big building. You have full control, speed, and privacy—no more noisy neighbors slowing things down.

In this guide, I’ll walk you through how to install WordPress on VPS hosting step by step. Don’t worry, even if you’re new to this, you’ll be fine. Let’s dive in!

vps for wordpress

 

Why Use a VPS for WordPress?

Wondering why people in Pakistan are moving from shared hosting to VPS hosting? Here’s why it makes sense:

  • Speed – Your site loads faster because you’re not sharing resources with strangers.

  • Control – Choose your own software versions and configure settings your way.

  • Security – A VPS is like having your own lockable room instead of a shared storage box.

  • Scalability – If your site grows, you can easily upgrade resources like RAM and storage.

👉 Many businesses in Lahore, Karachi, and Islamabad use VPS for WordPress to run WooCommerce stores, blogs, and company websites smoothly.

What You’ll Need Before You Start

  • A VPS server with root (admin) access.

  • A domain name pointed to your VPS IP address.

  • Basic comfort with the command line (don’t worry—I’ll explain).

  • Recommended VPS specs:

    • Small blog → 1 GB RAM, 1 vCPU

    • WooCommerce/business site → 2 GB RAM, 2 vCPU or higher

💡 If you don’t have a VPS yet, CreativeON offers VPS hosting in Pakistan at affordable rates. Since we’re an official Google partner and reseller, we keep prices low—passing savings directly to you.

Step 1: Connect to Your VPS

On Windows, open Command Prompt. On Mac/Linux, open Terminal.

ssh root@your_vps_ip

 

Enter your VPS password. If you see a warning about the server fingerprint, type yes. That’s normal on first login.

Step 2: Update Your Server

Keep your server updated (just like keeping your phone’s firmware fresh).

apt update && apt upgrade -y

 

Step 3: Install Web Server, PHP, and Database

WordPress needs three friends: a web server, PHP, and a database. We’ll use Nginx, PHP, and MariaDB.

Install Nginx:

apt install nginx -y

 

Install PHP and extensions:

apt install php-fpm php-mysql -y

 

Check your PHP version:

php -v

 

(Note this for later—you’ll need the correct socket path, like php8.2-fpm.)

Install MariaDB:

apt install mariadb-server -y

 

Step 4: Secure Your Server and Database

Enable firewall rules:

ufw allow OpenSSH

ufw allow ‘Nginx Full’

ufw enable

 

Secure MariaDB:

mysql_secure_installation

 

Follow prompts: set a root password, remove anonymous users, disable remote root login, and accept recommended settings.

Step 5: Create WordPress Database and User

Login to MariaDB:

mysql -u root -p

 

Then run:

CREATE DATABASE wp_db;

CREATE USER ‘wp_user’@’localhost’ IDENTIFIED BY ‘StrongPassword123!’;

GRANT ALL PRIVILEGES ON wp_db.* TO ‘wp_user’@’localhost’;

FLUSH PRIVILEGES;

EXIT;

 

Step 6: Download and Set Up WordPress

Go to your web folder:

cd /var/www/

 

Download WordPress:

wget https://wordpress.org/latest.tar.gz

tar -xzvf latest.tar.gz

mv wordpress your_domain

 

Set permissions:

chown -R www-data:www-data your_domain

chmod -R 755 your_domain

 

Step 7: Configure Nginx for WordPress

Create a new site config:

nano /etc/nginx/sites-available/your_domain

 

Paste this (replace your_domain and PHP version):

server {

    listen 80;

    server_name your_domain www.your_domain;

    root /var/www/your_domain;

    index index.php index.html;

 

    location / {

        try_files $uri $uri/ /index.php?$args;

    }

 

    location ~ \.php$ {

        include snippets/fastcgi-php.conf;

        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;

    }

}

 

Enable it and restart:

ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/

nginx -t

systemctl restart nginx

 

Step 8: Add SSL (HTTPS)

For security and SEO, always use HTTPS. Install Let’s Encrypt:

apt install certbot python3-certbot-nginx -y

certbot –nginx -d your_domain -d www.your_domain

 

Step 9: Complete WordPress Installation in Browser

Open:

http://your_domain

 

Choose your language → enter database details:

  • Database Name: wp_db

  • Username: wp_user

  • Password: StrongPassword123!

  • Host: localhost

Click Submit → Run Installation.

Create your admin account → Done! 🎉

Real-Life Uses of WordPress on VPS

  • Blogs – Share your travel stories, food recipes, or opinions.

  • Business Sites – Local businesses in Lahore and Karachi run their company sites on VPS for better performance.

  • Online Stores – Run WooCommerce for eCommerce without slowing down.

  • Portfolios – Designers, photographers, and freelancers host personal portfolios.

Troubleshooting Common Issues

  • Nginx fails to restart → Run nginx -t to check syntax errors.

  • 502 Bad Gateway → Check if PHP-FPM is running and update the socket path.

Permission issues → Re-run:

chown -R www-data:www-data /var/www/your_domain

  •  

Quick Summary

  • Connect: SSH into your VPS.

  • Update: Run system updates.

  • Install: Nginx, PHP, MariaDB.

  • Secure: Firewall + database.

  • Database: Create WordPress DB & user.

  • Download: WordPress files.

  • Configure: Nginx + SSL.

  • Finish: Complete setup in browser.

  • Your WordPress VPS in Pakistan is now live 🚀

Table of Contents