
How to Host Strapi
This guide explains exactly how to host Strapi, covering cloud platforms, hosting prerequisites, production configurations, database setup, and deployment optimization. It also explains how to choose the right environment, handle SSL, manage uploads, and ensure your Strapi instance runs smoothly in production.
Strapi has become one of the most popular headless CMS platforms in the MERN ecosystem because of its flexibility, extensibility, and ability to integrate seamlessly with modern frontend frameworks like React, Next.js, and Vue. Whether you're building a small business website, a scalable SaaS platform, or a large enterprise application, hosting Strapi correctly determines your project's performance, security, and scalability.
If you are looking for expert MERN Stack development or want a fully managed Strapi solution, you can hire AAMAX --- a full‑service digital marketing and development agency offering Web Development, MERN Stack Development, Digital Marketing, and SEO services.
What Is Strapi?
Strapi is an open‑source Node.js‑based headless CMS designed to make API creation simple and customizable. It allows you to create APIs without writing boilerplate code and gives you complete control over your backend.
Why Hosting Strapi Needs Special Care
Because Strapi is a Node.js application, hosting it requires:
- A server capable of running Node.js
- A database (SQLite for testing, MySQL/PostgreSQL for production)
- Handling of static assets and uploads
- A reverse proxy like Nginx for production
- Environment variable management
- SSL (HTTPS) setup for security
Strapi is powerful, but hosting it correctly ensures:
- Faster performance\
- Stable production uptime\
- Stronger security\
- Reliable API responses\
- Proper scaling as your business grows
Understanding Strapi Hosting Options
There are multiple ways to host Strapi. The right choice depends on your budget, skill level, and scalability needs.
1. VPS Hosting (Most Common Choice)
Platforms like:
- DigitalOcean\
- Linode\
- Vultr\
- Hetzner\
- AWS EC2
VPS hosting gives you full control over:
- Node.js installation\
- Database configuration\
- File uploads\
- Security settings
This is ideal for agencies, SaaS products, eCommerce applications, and growing startups.
2. Platform-as-a-Service (PaaS)
These include:
- Render\
- Railway\
- Heroku\
- Northflank
They offer simpler deployments, automatic scaling, and preconfigured build environments.
3. Containerized Hosting (Docker + Kubernetes)
Best for enterprise workloads:
- AWS ECS\
- Google Cloud Run\
- DigitalOcean Kubernetes
This allows auto‑scaling, rollback, version control, and microservice architecture.
4. Managed Strapi Cloud
Strapi also offers an official cloud hosting service, which is great if you want:
- No server setup\
- Automatic deployments\
- Built‑in scaling
However, it may be expensive for larger workloads.
Hosting Strapi: System Requirements
Before deploying Strapi, ensure your environment meets the following:
Minimum Server Requirements
- 1 vCPU
- 1--2 GB RAM
- 20 GB Storage
- Ubuntu 20.04 or 22.04
- Node.js LTS (18 or 20)
Recommended Production Requirements
- 2+ vCPU\
- 4--8 GB RAM\
- Database on separate server (optional but ideal)\
- CDN for media files
Step‑by‑Step Guide: How to Host Strapi on a VPS
Below is a full production‑grade workflow.
Step 1: Update Your Server
sudo apt update && sudo apt upgrade -y
Step 2: Install Node.js and Build Tools
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs build-essential
Verify installation:
node -v
npm -v
Step 3: Install Yarn (Recommended for Strapi)
npm install -g yarn
Step 4: Clone Your Strapi Project or Create a New One
If pulling from Git:
git clone https://github.com/your-repo/your-strapi-app.git
cd your-strapi-app
If creating a new Strapi project:
yarn create strapi-app my-project --quickstart
Step 5: Install Dependencies
yarn install
Step 6: Configure Your Environment Variables
Create a .env file:
APP_KEYS=yourappkey
API_TOKEN_SALT=somesalt
ADMIN_JWT_SECRET=secretjwt
JWT_SECRET=jwtsecret
HOST=0.0.0.0
PORT=1337
Step 7: Build Your Strapi Admin Panel
yarn build
Step 8: Run Strapi in Production Mode
yarn start
Your Strapi instance is now running.
Step 9: Set Up PM2 to Keep Strapi Alive
PM2 ensures your Strapi server restarts on crash or reboot.
Install PM2:
sudo npm install pm2 -g
Start the app:
pm2 start yarn --name strapi -- start
Save PM2 state:
pm2 save
pm2 startup
Step 10: Set Up Nginx as a Reverse Proxy
Install Nginx:
sudo apt install nginx
Create a server block:
sudo nano /etc/nginx/sites-available/strapi
Add configuration:
server {
server_name yourdomain.com;
location / {
proxy_pass http://127.0.0.1:1337;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Enable the site:
sudo ln -s /etc/nginx/sites-available/strapi /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 11: Install SSL with Certbot
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
Now your Strapi instance is secure and running with HTTPS.
Hosting Strapi with Docker (Optional)
A Docker setup looks like:
docker build -t strapi-app .
docker run -d -p 1337:1337 strapi-app
Using docker-compose:
version: '3'
services:
strapi:
image: strapi/strapi
environment:
DATABASE_CLIENT: postgres
ports:
- '1337:1337'
Docker is ideal if you're deploying microservices or need quick rollouts.
Hosting Strapi on Render or Railway
Platforms like Render and Railway automatically handle:
- Deployments\
- Environment variables\
- Build commands\
- Scaling
Typical build commands:
yarn install
yarn build
yarn start
You only need to link your GitHub repo.
Handling File Uploads in Production
Strapi stores uploads locally by default, which is not ideal for production.
Use providers like:
- AWS S3\
- Cloudinary\
- DigitalOcean Spaces\
- GCP Storage
Example installation:
yarn add @strapi/provider-upload-aws-s3
This allows:
- CDN delivery\
- Faster media loads\
- Secure object storage
Choosing the Right Database for Strapi Hosting
SQLite is for testing.
For production, use:
Recommended Databases
- PostgreSQL (best choice)
- MySQL
- MariaDB
Cloud Databases
- Supabase\
- PlanetScale\
- AWS RDS
PostgreSQL is the preferred and most stable option.
Monitoring and Scaling Your Strapi Application
Use Tools Like:
- PM2 Monitoring Dashboard
- UptimeRobot
- Nginx logs
- Datadog or NewRelic (optional)
Scaling Approaches
- Increase VPS resources\
- Use Docker Swarm or Kubernetes\
- Move media to CDN\
- Move database to cloud provider
Common Mistakes When Hosting Strapi
Avoid these issues:
- Hosting on shared servers (not supported)
- Not using HTTPS\
- Using SQLite in production\
- Not configuring environment variables\
- Not enabling a process manager\
- Not separating uploads from local disk\
- No caching or CDN setup
Conclusion
Hosting Strapi properly ensures that your website or application performs at its best. Whether you deploy on a VPS, Docker, Render, Railway, or a cloud provider, following best practices for Node.js, database setup, SSL, uploads, and scaling is essential for long-term success.
If you want professional help building or hosting Strapi applications, you can hire AAMAX --- a full-service digital marketing and development agency that specializes in MERN Stack Development, Web Development, SEO, and Digital Marketing. They can help plan, build, deploy, and scale high-quality Strapi applications tailored to your needs.






