Moving from shared hosting to a VPS in India: limits, sizing and a zero-downtime checklist

2026-12-01来源 dev.toEnglish

Whether you need a VPS at all is covered in VPS vs shared hosting. This post is about the move itself: confirming the shared plan is the bottleneck, sizing PHP-FPM, and copying a live site off a cPanel account onto a bare Linux server without an outage.

Commands assume Ubuntu 24.04 LTS or Debian 12 on the new server, Nginx or Apache with PHP-FPM, and MySQL or MariaDB. example.com, old-host.example.net and 203.0.113.10 (the new server) are placeholders.

Confirm the plan, not your code, is the limit

Most Indian shared hosting runs cPanel on CloudLinux, which puts each account in a lightweight virtual environment (LVE). The CloudLinux limits documentation names the limits you will see in cPanel's Resource Usage page: SPEED (CPU, relative to one core), PMEM (physical memory), IO and IOPS (disk), NPROC (processes) and EP (entry processes, roughly concurrent PHP requests).

A 508 Resource Limit Reached error is the clearest one. On Apache-based CloudLinux servers it means the entry-process (EP) limit is full; LiteSpeed hosts count entry processes differently and can show it differently. A few a month is noise; every weekday at 11:00 IST is a pattern.

When EP is full, new PHP requests queue. Measure it from a machine in India, at a quiet hour and again at your busiest, on a page that cannot be cached (search results, a cart, a logged-in page):

for i in $(seq 1 10); do curl -s -o /dev/null -w '%{time_starttransfer}\n' 'https://example.com/?s=test' sleep 2 done 

time_starttransfer is the time until the first byte arrives (see the curl -w reference). If busy-hour numbers are several times the quiet-hour ones with unchanged code, requests are waiting for a free PHP slot. Rule out a broken page cache or a slow plugin first: a slow site moved to a VPS is still slow.

Sizing PHP-FPM on the new server

Typical memory per component and starting sizes by workload are in How much RAM does your VPS actually need?. The part a table cannot give you is your own PHP worker size. Once the site runs on the VPS, measure it. The process is php-fpm8.3 on Ubuntu 24.04 and php-fpm8.2 on Debian 12:

ps --no-headers -o rss,args -C php-fpm8.3 \ | awk '/pool/ {s+=$1; n++} END {if (n) printf "%d workers, avg %.0f MB\n", n, s/n/1024}' 

The /pool/ filter counts only pool workers (php-fpm: pool www) and skips the master process. Divide the memory you can give PHP, after the database and OS, by that average to get pm.max_children for the pool; the directive is described in the PHP-FPM configuration reference. Re-measure under real traffic, because WooCommerce and page-builder requests are much heavier than the home page.

Choosing a region in India

Pick the region closest to most of your users; for most Indian providers that means Mumbai or Delhi NCR. Routing between Indian ISPs does not follow the map, so ask for a test IP in each region and run this from your users' cities, on broadband and mobile data:

mtr -rwc 20 <test-ip> 

Read the average latency and loss on the last hop. If your audience is split, choose for your paying users and put static assets behind a CDN.

The migration, in order

Copy, test, then switch: at no point should only one working copy exist.

1. DNS prep

TTL timing, resolver caching and keeping the old host as your rollback are covered in Switching web hosts: what actually happens to DNS, TTL, email and SSL. Two checks matter here. First, read the configured TTL from an authoritative nameserver; a plain dig asks your local resolver, which prints the remaining cached time and can show 1200 for a record set to 86400:

NS=$(dig +short NS example.com | head -n1) dig +noall +answer example.com A @"$NS" dig +noall +answer example.com MX @"$NS" 

Second, look at the MX answer. cPanel zones often point MX at example.com itself, so the mail follows the A record: the moment you switch it, mail goes to a VPS with no mailboxes and bounces. Move the mailboxes and point MX at their new home before cutover.

2. Inventory the shared account

List every domain, subdomain, database, cron job (crontab -l) and .htaccess rule, and export the DNS zone. Match the PHP version and extensions on the VPS.

3. Copy the files with rsync

Many cPanel hosts allow SSH, sometimes on a non-standard port. Pull from the VPS side:

sudo mkdir -p /var/www/example.com sudo chown "$USER": /var/www/example.com rsync -az --info=progress2 -e 'ssh -p 22' \ cpuser@old-host.example.net:public_html/ /var/www/example.com/ 

The trailing slash on the source copies the directory's contents rather than the directory itself; -a preserves permissions and times, and -z compresses in transit (rsync manual). If the host offers no SSH, download a full cPanel backup and unpack it on the VPS instead.

Then fix ownership. Do not hand the whole tree to the web server user: if www-data can write PHP files, any compromised plugin can rewrite core and theme code. Keep your own user as owner, www-data as group, and give the server write access only where the app needs it:

sudo chown -R "$USER":www-data /var/www/example.com sudo find /var/www/example.com -type d -exec chmod 755 {} + sudo find /var/www/example.com -type f -exec chmod 644 {} + sudo chown -R www-data:www-data /var/www/example.com/wp-content/uploads 

A dedicated FPM pool user per site is better still.

4. Dump, copy and import the database

On the old host:

mysqldump --single-transaction --quick --routines --events --no-tablespaces \ -u cpuser_db -p cpuser_wp | gzip > wp.sql.gz 

--single-transaction takes a consistent snapshot of InnoDB tables without locking the site; --quick streams rows instead of buffering whole tables; routines and events are not dumped by default, so they are named; and --no-tablespaces avoids the PROCESS privilege mysqldump otherwise needs, which shared accounts rarely have. All are in the MySQL 8.4 mysqldump reference and the MariaDB equivalent. On MariaDB the tool is mariadb-dump, with mysqldump kept as a symlink.

Copy the dump to the VPS, then delete it from the shared account, since it holds the whole database:

rsync -az -e 'ssh -p 22' cpuser@old-host.example.net:wp.sql.gz . ssh -p 22 cpuser@old-host.example.net 'rm wp.sql.gz' 

Before importing, check the dump for two things that break restores:

zgrep -o 'DEFINER=`[^`]*`@`[^`]*`' wp.sql.gz | sort -u zgrep -c 'utf8mb4_0900_ai_ci' wp.sql.gz 

Triggers, views and routines carry a DEFINER naming the old cPanel database user, which will not exist on the new server. A MySQL 8 dump using utf8mb4_0900_ai_ci will not import into MariaDB 10.11, the version Debian 12 and Ubuntu 24.04 ship (MariaDB only accepts that name from 11.4.5). Keep the same engine, or rewrite both while unpacking:

gunzip < wp.sql.gz \ | sed -e 's/DEFINER=`[^`]*`@`[^`]*`/DEFINER=`wp`@`localhost`/g' \ -e 's/utf8mb4_0900_ai_ci/utf8mb4_unicode_ci/g' > wp.sql 

Create the database and user inside an interactive session, so the password does not end up in ~/.bash_history (both Ubuntu's mysql-server and Debian's mariadb-server let root in through the local socket with sudo):

sudo mysql 
CREATE DATABASE wp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'wp'@'localhost' IDENTIFIED BY 'a-long-random-password'; GRANT ALL PRIVILEGES ON wp.* TO 'wp'@'localhost'; EXIT; 

Then import with sudo mysql wp < wp.sql, and update the credentials in wp-config.php or equivalent.

5. Test through the hosts file and --resolve

Point only your own machine at the new server. Add a line to /etc/hosts on Linux or macOS, or C:\Windows\System32\drivers\etc\hosts on Windows:

203.0.113.10 example.com www.example.com 

To be sure you are really on the VPS, drop a marker file there (echo vps > /var/www/example.com/which.txt) and open /which.txt. Then click through as a customer would: a deep page, a form, login, checkout, the 404 page. Remove the hosts entry afterwards.

For scripted checks, curl's --resolve pins a name to an address for one request, without editing any file, and still sends the right Host header and SNI:

curl -sI --resolve example.com:80:203.0.113.10 http://example.com/ curl -sI --resolve example.com:443:203.0.113.10 https://example.com/ 

The HTTPS check only passes once a certificate exists on the VPS; issue one in advance with a DNS-01 challenge, or with HTTP-01 straight after the switch.

6. Cut over

At a quiet hour (late evening or early morning IST for an Indian audience), put a dynamic site into maintenance mode on the old host with WP-CLI: wp maintenance-mode activate. WordPress ignores the .maintenance file once it is 10 minutes old, so if the cutover takes longer, run wp maintenance-mode activate --force again, or the old site starts accepting orders and comments that you will lose.

Rerun the rsync with --delete, so plugins and cache files removed since the first copy disappear from the VPS too, and exclude the maintenance file so the new site does not inherit it. Try it with --dry-run first:

rsync -az --delete --exclude=.maintenance --dry-run -e 'ssh -p 22' \ cpuser@old-host.example.net:public_html/ /var/www/example.com/ 

Drop --dry-run and run it again, re-apply the ownership commands from step 3, take a fresh dump, copy and import it as in step 4 (drop and recreate the wp database first), then change the A record. Watch the new server's access and error logs for an hour, and keep the shared account running for at least a week as your rollback.

What you now manage yourself

On an unmanaged VPS, these jobs are yours:

  • Updates. Ubuntu Server installs unattended-upgrades by default and applies security updates automatically (Ubuntu docs). On Debian 12, check with dpkg -s unattended-upgrades, then sudo apt install unattended-upgrades and sudo dpkg-reconfigure unattended-upgrades (Debian wiki). Kernel updates still need a reboot you schedule.
  • Firewall. ufw ships with Ubuntu 24.04; on Debian 12 install it first with sudo apt install ufw. Allow SSH before enabling, because ufw enable can drop existing SSH connections (ufw manual):
 sudo ufw allow OpenSSH sudo ufw allow 80,443/tcp sudo ufw enable sudo ufw status verbose 

The OpenSSH profile opens port 22 only. If sshd listens on another port, allow that port instead (for example sudo ufw allow 2222/tcp) before enabling, or you lock yourself out.

  • SSH. Key-only login, no root password login.
  • Backups. Nightly database dumps plus files, copied off the server, and a restore you have actually tested.
  • Monitoring. An external uptime check, and alerts for disk space and memory. A full disk breaks MySQL as surely as running out of RAM.
  • TLS renewal. Certbot's timer renews certificates; check it once with sudo certbot renew --dry-run.

For transparency, this post is from Bigdomainhost, an Indian host that started trading in September 2026 and runs KVM VPS in Mumbai (BOM-1) and Delhi NCR (DEL-1). The fuller checklist, including the items people forget, is in How to switch web hosts with zero downtime.

Written by the Bigdomainhost team with AI assistance; facts checked against the linked sources.

原文:https://www.a8q9.cn/en/article/moving-from-shared-hosting-to-a-vps-in-india-limits-sizing-and-a-zero-downtime-c-2dd6d2.html

相关文章