Servers & VPS

How to Configure a VPS for Your Online Store in Mexico

A step-by-step guide to setting up a VPS server in Mexico to host your online store securely, quickly, and ready to sell.

Numerous wires and cables mounted into server patch panel in modern data center

To set up an online store on a VPS, the sequence is: install the OS, configure the LAMP (or LEMP) stack, harden the server, install your ecommerce platform, and activate SSL. Follow that order and you'll have a production-ready environment accepting orders within a few hours.

Everything below uses Ubuntu 22.04 LTS — the most widely available distribution among Mexican VPS providers — with exact commands for each stage.

Why a VPS instead of shared hosting for your store?

Shared hosting works for light traffic, but it hits a wall precisely when you need it most: hot sale events, Christmas season, or a big email campaign.

  • Dedicated resources: no other tenant is consuming your RAM or CPU.
  • Full control: install the exact PHP version, MySQL release, and extensions your platform requires.
  • Clean IP: your email reputation is not tied to other accounts on the same server.
  • Real scalability: add RAM and CPU as your sales grow without migrating providers.

If you're still weighing the decision, check our full overview in the VPS servers category.

Step 1 — Initial access and system update

The first thing to do with a new VPS is connect via SSH and update all packages. Never install software on an outdated base system.

ssh root@YOUR_VPS_IP
apt update && apt upgrade -y

Then create a non-root user for day-to-day work and disable root SSH login:

adduser store
usermod -aG sudo store
nano /etc/ssh/sshd_config
# Change: PermitRootLogin no
systemctl reload ssh

This step is mandatory before opening any port to the public. Ecommerce servers are frequent targets of automated attacks.

Step 2 — Install the LAMP stack (or LEMP)

Most ecommerce platforms — WooCommerce, PrestaShop, Magento, OpenCart — run on PHP + MySQL + Apache or Nginx. The example below uses Apache (LAMP); the Nginx path is nearly identical.

apt install -y apache2 mysql-server php php-mysql php-curl \
  php-gd php-mbstring php-xml php-zip php-intl libapache2-mod-php

Verify both services are running:

systemctl status apache2
systemctl status mysql

Secure the MySQL installation:

mysql_secure_installation

Answer Y to all prompts: set a root password, remove anonymous users, disable remote root access, and drop the test database.

Step 3 — Create a database for your store

Each store should have its own database and a dedicated user. Never use the MySQL root account for the application itself.

mysql -u root -p
CREATE DATABASE store_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'store_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON store_db.* TO 'store_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

The utf8mb4 charset is required if your catalog includes special characters, accents, or emoji.

Step 4 — Configure Apache and activate SSL with Let's Encrypt

Before installing your platform, configure an Apache Virtual Host for your domain and enable HTTPS. An SSL certificate is non-negotiable for any store accepting online payments — without it, browsers display security warnings that destroy conversion rates.

nano /etc/apache2/sites-available/mystore.conf

Basic Virtual Host content:

<VirtualHost *:80>
  ServerName mystore.com.mx
  ServerAlias www.mystore.com.mx
  DocumentRoot /var/www/mystore
  <Directory /var/www/mystore>
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

Enable the site and the rewrite module (needed for SEO-friendly URLs):

a2ensite mystore.conf
a2enmod rewrite
systemctl reload apache2

Install Certbot and obtain your free certificate:

apt install -y certbot python3-certbot-apache
certbot --apache -d mystore.com.mx -d www.mystore.com.mx

Certbot automatically renews the certificate before expiry — no manual action needed every 90 days.

Step 5 — Install your ecommerce platform

With the environment ready, download and install your platform. The example below covers WooCommerce (WordPress); the steps are equivalent for PrestaShop or OpenCart.

cd /var/www/mystore
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz --strip-components=1
chown -R www-data:www-data /var/www/mystore

Open your domain in a browser and follow the setup wizard. You'll have the database name, user, and password ready from step 3.

Platform Min PHP Recommended RAM Best for
WooCommerce 7.4+ 2 GB Mid-size stores, WordPress users
PrestaShop 8.0+ 2 GB Large product catalogs
Magento 2 8.1+ 4 GB High-volume enterprise stores
OpenCart 7.4+ 1 GB Small stores / tight budgets

Step 6 — Basic security before going live

Before accepting your first order, enable the firewall and tune a few PHP settings:

ufw allow OpenSSH
ufw allow 'Apache Full'
ufw enable

In /etc/php/8.x/apache2/php.ini, adjust:

expose_php = Off
upload_max_filesize = 20M
post_max_size = 20M
max_execution_time = 60

Also install fail2ban to block brute-force attempts:

apt install -y fail2ban
systemctl enable --now fail2ban

For deeper server hardening, the team at elenlace.com provides security audits for production VPS environments.

Key takeaways

  • Always update the OS before installing any software on a new VPS.
  • Create a non-root user and disable root SSH login on day one.
  • Use a dedicated database and user per store — never the MySQL root account.
  • Let's Encrypt SSL is free and mandatory for any store that processes payments.
  • Enable UFW and fail2ban before opening the site to the public.

Ready to launch your store on a properly configured VPS? The team at elenlace.com can set up and manage your server so you can focus entirely on selling.

FAQ

How much RAM does a VPS need for a small online store?

For WooCommerce or OpenCart with up to 500 products and moderate traffic, 2 GB of RAM is sufficient. If you use Magento 2 or expect traffic spikes from campaigns, start with 4 GB.

Can I host multiple stores on a single VPS?

Yes. Create a separate Virtual Host per domain and an independent database for each store, and make sure the VPS has enough resources. With 4 GB of RAM you can comfortably run 2–3 mid-size stores.

Does Let's Encrypt work with .com.mx domains?

Yes. Let's Encrypt issues certificates for any domain with valid DNS resolution, including .com.mx and .mx. You just need the domain's DNS pointing to your VPS IP before running Certbot.

Do I need a managed VPS or can I handle it myself?

If you have basic Linux and SSH experience, you can self-manage by following this guide. If you'd rather focus 100% on the business, a managed VPS includes updates, monitoring, and technical support without you ever touching a terminal.

Useful resources

Other providers and guides worth comparing:

← All