Choosing a VPS
VPS for Online Stores: Sizing, Caching, Backups and Security
By NileVPS Team · Published · 5 min read
اقرأ المقال بالعربيAn online store is less forgiving than a blog. A slow product page loses buyers, a broken checkout loses revenue directly, and a security incident can cost customer trust that took years to build. Shared hosting often struggles once a store has real traffic, many plugins and background jobs. A VPS gives you dedicated resources and full control over the stack. This guide covers how to size the server, cache safely, back up the right data and keep payments secure, with WooCommerce as the main example. The same ideas apply to Magento, PrestaShop, OpenCart and custom stores.
Why stores outgrow shared hosting
Stores do much more dynamic work than content sites. Every cart update, search, filter and checkout runs PHP and hits the database, and none of those pages can be served from a simple page cache. Add scheduled tasks such as stock sync, order emails and abandoned-cart reminders, and you need predictable CPU and memory that are not shared with hundreds of other sites.
Sizing your store server
There is no universal number, because the plugin count, theme quality and catalog size matter as much as traffic. These are reasonable starting points:
| Store profile | vCPU | RAM | Notes |
|---|---|---|---|
| New store, small catalog, low traffic | 2 | 4 GB | Web server, PHP and database on one server |
| Growing store, hundreds of orders a week | 4 | 8 GB | Add Redis object cache, tune PHP-FPM workers |
| Busy store, large catalog, campaigns | 8+ | 16 GB+ | Consider a separate database server |
Use NVMe storage for the database, and choose the data center closest to your customers. Before a big campaign such as a seasonal sale, resize up in advance and load-test the checkout, then scale back afterwards if traffic returns to normal. Compare plans on /pricing.
A solid stack
- Web server: Nginx in front of PHP-FPM.
- PHP: a currently supported release (8.2 or newer) with OPcache enabled.
- Database: MariaDB or MySQL 8, with
innodb_buffer_pool_sizeset to roughly half to two thirds of the RAM available to the database. - Object cache: Redis to store repeated database query results.
- Real cron: disable WordPress pseudo-cron and run it from the system so background jobs do not slow down visitor requests.
// wp-config.php
define('DISABLE_WP_CRON', true);# crontab -e for the site user
*/5 * * * * cd /var/www/store && php wp-cron.php > /dev/null 2>&1For a deeper look at tuning PHP-FPM, OPcache and Redis, see our guide on WordPress performance on a VPS.
Caching without breaking the cart
Full-page caching makes catalog pages very fast, but it must never cache personal pages. Exclude at least:
/cart/,/checkout/,/my-account/and their translated equivalents- Any request with WooCommerce cookies such as
woocommerce_items_in_cart,woocommerce_cart_hashorwp_woocommerce_session_* - Logged-in users (
wordpress_logged_in_*cookie) - POST requests and URLs with query strings like
add-to-cart
A cache that ignores these rules can show one customer's cart to another, which is both a bug and a privacy problem. Static assets such as images, CSS and JavaScript are always safe to cache for a long time, and a CDN helps with them.
Backups that match how a store works
A store changes every few minutes: new orders, stock levels, customer accounts. A weekly backup means losing a week of orders in a disaster.
- Database: dump it at least daily, and more often for busy stores. Use
mysqldump --single-transactionso the dump is consistent without locking tables. - Files: back up
wp-content/uploadsand your configuration; plugins and themes can be reinstalled but should still be included for fast recovery. - Snapshots: take one before every plugin, theme or core update.
- Off-site: keep copies outside the server and test a restore regularly.
mysqldump --single-transaction -u store -p storedb | gzip > /var/backups/storedb-$(date +%F).sql.gzSSL and HTTPS
HTTPS is mandatory for any store. Issue a free certificate with Let's Encrypt and redirect all HTTP traffic:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.comCertbot installs a renewal timer automatically; confirm it with systemctl list-timers | grep certbot. Once everything loads over HTTPS without mixed-content warnings, consider enabling HSTS.
Payment security
The safest approach is to never let card data touch your server. Use a payment gateway with a hosted payment page or embedded fields, where the card details go directly to the provider. This greatly reduces your PCI DSS scope, although you still need to follow the gateway's requirements.
Further hardening:
- Keep WordPress core, WooCommerce, plugins and themes updated, and remove unused plugins.
- Use strong admin passwords and two-factor authentication for every admin account.
- Allow only ports 80, 443 and SSH in the cloud firewall, and restrict SSH to your IP addresses where possible.
- Protect
wp-login.phpandxmlrpc.phpwith rate limiting or by blocking XML-RPC if you do not need it. - Monitor logs for unusual admin logins and sudden spikes of failed orders.
FAQ
How many visitors can a store VPS handle?
It depends on how many pages can be cached and how heavy your plugins are. Cached catalog pages are cheap; uncached cart and checkout requests are expensive. Measure with a load test against your real store rather than relying on a generic visitor number.
Should the database run on a separate server?
Not at first. One well-tuned server is simpler and fast. Move the database to its own server when it starts competing with PHP for memory or CPU, or when you want to scale the web layer independently.
Do I need PCI DSS compliance if I use a payment gateway?
Most merchants still have some obligations, but using a hosted payment page or the gateway's embedded fields keeps card data off your server and makes those obligations much lighter. Check the exact requirements with your payment provider.