Deployment guide

Hosting Meilisearch on a VPS

Deploy on a VPS Cloud →

Databases6 min read

Hosting Meilisearch on a VPS

Meilisearch is an ultra-fast open-source search engine, written in Rust, that returns relevant results in under 50 milliseconds with typo tolerance and instant search. Lightweight and simple to operate, it self-hosts ideally on a VPS to power the search of your site or application. Here is how to deploy it with Docker, the master key and an SSL certificate.

Why self-host Meilisearch on a VPS

Meilisearch offers a "search-as-you-type" experience comparable to commercial solutions, but under an open-source licence and with minimal configuration: no esoteric analyzer tuning, sensible defaults, and a clear API. Self-hosting it on a VPS spares you the per-document and per-search billing of managed services like Algolia, while keeping your indexes and your product data on your own infrastructure. It is a particularly cost-effective choice for an e-commerce site, a blog or documentation: a single modest VPS serves hundreds of thousands of searches per day with very low latency. You control the API keys, the filterable attributes and relevance, and you can reindex at will with no quota constraints.

The concrete benefits of self-hosting Meilisearch

  • Instant search under 50 ms with typo tolerance enabled by default.
  • Minimal configuration: sensible relevance settings out of the box, up and running in a few minutes.
  • Built-in filtering, facets, sorting and highlighting to build a complete search UI.
  • Written in Rust: a reasonable memory footprint and high throughput even on a small VPS.
  • A simple API with SDKs for most languages and ready-to-use front-end integrations.
  • No cost per indexed document or per query, unlike managed search engines.

Hardware and software prerequisites

Meilisearch is frugal but loads part of its indexes into memory to stay fast. For an index of a few tens of thousands of documents, 1 to 2 GB of RAM is enough; for hundreds of thousands of documents with many filterable attributes, aim for 2 to 4 GB. The indexing phase is the most demanding on RAM and CPU, so allow some headroom for reindexing. One to two vCPUs are fine, and 20 to 40 GB of SSD covers the index and its snapshots. You will need Docker, a domain if you expose the API publicly, and a MEILI_MASTER_KEY without fail: without it, in production mode, the instance refuses to start to protect you from open access.

Deploy Meilisearch step by step

01

Provision the VPS and Docker

Install Docker and configure the firewall to open only 80 and 443. Create a DNS A record for recherche.mydomain.com pointing to the VPS IP.

02

Launch Meilisearch in production mode

Use the getmeili/meilisearch image. Set MEILI_ENV=production and MEILI_MASTER_KEY with a strong key (openssl rand -base64 32). Mount a volume on /meili_data to persist the indexes: volumes: - ./meili_data:/meili_data.

03

Manage the API keys

From the master key, generate scoped keys: a search key to expose on the front-end, and an admin key on the server side for indexing. Never expose the master key in the browser.

04

Configure the reverse proxy and TLS

Place Caddy in front of port 7700: recherche.mydomain.com { reverse_proxy localhost:7700 }. Caddy obtains the Let's Encrypt certificate automatically and encrypts all search traffic.

05

Index your data and tune relevance

Push your documents via the API or an SDK, then define the searchableAttributes, filterableAttributes and sortableAttributes as well as the rankingRules suited to your use case (e-commerce, docs, blog).

06

Enable snapshots and backup

Configure Meilisearch's regular snapshots or dumps and copy them to remote storage. In the event of an incident, a dump lets you rebuild the instance with its indexes and settings.

Keep the list of filterableAttributes to the strict minimum: each filterable attribute increases the index size and the indexing time. For a responsive search UI, connect the front-end directly to Meilisearch with a scoped "search" key (limited to certain indexes) rather than relaying every request through your backend, which removes a round trip and reduces perceived latency. During a bulk reindex, monitor the task via the /tasks API rather than blocking while you wait.

Power your search with Meilisearch

The ServOrbit Cloud VPS provides the Docker environment, the fixed IP and the NVMe disks to host Meilisearch and offer instant search to your visitors, with SSL and API keys under control.

Need help?

Browse our help center and FAQ, or write to our team — support in French, English and Arabic.