Tutorial

Self-hosting

How to install Magento on a VPS

Magento Open Source (the open-source edition that Adobe Commerce is built on) is a powerful e-commerce platform, built for large catalogues and advanced customisation needs. Self-hosted on your VPS, it gives you full control of your store, its performance and its customer data, without depending on costly managed hosting. Here is how to install it cleanly with Docker, a reverse proxy and HTTPS.

3 min read7 steps
Contents· Why host Magento on your own VPS1/5
  1. 01Why host Magento on your own VPS
  2. 02The concrete benefits of a self-hosted Magento
  3. 03Hardware and software requirements
  4. 04Install Magento with Docker and HTTPS
  5. 05The official documentation

Why host Magento on your own VPS

Magento is resource-hungry and sensitive to configuration: shared hosting cannot handle the load, and specialised managed offers are expensive. A dedicated VPS lets you size PHP, the database and the cache (Redis, OpenSearch) precisely, keep your customer data and orders under your control, and deploy your extensions without restrictions imposed by a provider.

The concrete benefits of a self-hosted Magento

  • Adjustable performance: you size PHP-FPM, Redis and OpenSearch according to your catalogue.
  • Sovereignty over customer data and order history.
  • Complete freedom of extensions and themes, without a host's approval.
  • Staging environments easy to create for testing updates.
  • Controlled cost compared with high-end managed e-commerce offers.
  • Progressive scaling: add vCPU and RAM during seasonal peaks.

Hardware and software requirements

Magento is demanding. Plan for at least 4 GB of RAM (6 to 8 GB recommended in production), 2 to 4 vCPU and 20 GB of disk or more depending on the catalogue and media. For Magento 2.4.9, the stack requires PHP 8.5, MariaDB 12.3 or MySQL 8.4, OpenSearch 3 and Valkey 9 (Redis-compatible); Elasticsearch is no longer listed in the requirements. On the network side: a domain name (e.g. shop.your-domain.com) pointing to the VPS and port 443 open.

Install Magento with Docker and HTTPS

  1. Prepare the VPS and Docker

    Over SSH, update the system and install Docker via curl -fsSL https://get.docker.com | sh. Create a folder mkdir -p /opt/magento && cd /opt/magento.

  2. Assemble the stack

    Put together a docker-compose bringing together PHP-FPM, Nginx, MariaDB, Valkey and OpenSearch, and publish ports on 127.0.0.1 only (e.g. 127.0.0.1:8080:80 for the web container, no port at all for the database, Valkey and OpenSearch). The community project markshust/docker-magento is designed for local development, not production: use it as a reference, not as your live stack.

  3. Get Magento via Composer

    With your Adobe access keys (Public/Private keys), run composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition.

  4. Launch the installation

    Run bin/magento setup:install providing the database, OpenSearch, base URL and admin account, then bin/magento setup:di:compile and bin/magento deploy:mode:set production.

  5. Configure the reverse proxy

    Place Caddy or Nginx in front of the web container: shop.your-domain.com { reverse_proxy localhost:8080 }. Caddy handles Let's Encrypt TLS automatically.

  6. Optimise and secure

    Enable the Redis cache for sessions and pages, configure the Magento crons, restrict admin access by IP and schedule backups of the database and media.

  7. Logging in for the first time

    Open the admin URL shown at the end of the installation (the "Admin Panel URI" line, also available with bin/magento info:adminuri) and log in with the admin account you created. Two-factor authentication has been enabled by default since Magento 2.4: set up a method (Google Authenticator, for example) during this first login.

Always enable production mode (deploy:mode:set production) before going live: it precompiles the code and assets, which radically changes response times compared with developer mode.

The official documentation

For advanced configuration and tool-specific options, refer to the official Magento / Adobe Commerce documentation. This guide covers going live on a VPS; the vendor documentation remains the reference for fine-tuning, major updates and specific use cases.

Deploy your instance on a ServOrbit Cloud VPS

A ServOrbit Cloud VPS with preconfigured Docker and scalable resources lets you install this tool without friction, and adjust RAM and vCPU as usage grows.