Deployment

Strapi gives you many possible deployment options for your project or application. Strapi can be deployed on traditional hosting servers or services such as 21YunBox, Render, Heroku, AWS, Azure and others. The following documentation covers how to develop locally with Strapi and deploy Strapi with various hosting options.

TIP

Deploying databases along with Strapi is covered in the Databases Guide.

Hosting Provider Guides

Manual guides for deployment on various platforms, for One-click and docker please see the installation guides.

[Deployment - 图1

21YunBox

Step by step guide for deploying on 21YunBox

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/21yunbox.html)

[Deployment - 图2

Amazon AWS

Step by step guide for deploying on AWS EC2

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/amazon-aws.html)

[Deployment - 图3

Azure

Step by step guide for deploying on Azure

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/azure.html)

[Deployment - 图4

DigitalOcean

Manual step by step guide for deploying on DigitalOcean droplets

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/digitalocean.html)

[Deployment - 图5

Google App Engine

Manual step by step guide for deploying on GCP’s App Engine

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/google-app-engine.html)

[Deployment - 图6

Heroku

Step by step guide for deploying on Heroku

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/heroku.html)

[Deployment - 图7

Render

Three different options for deploying on Render

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/render.html)

[Deployment - 图8

Qovery

Step by step guide for deploying on Qovery

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/hosting-guides/qovery.html)

Optional Software Guides

Additional guides for optional software additions that compliment or improve the deployment process when using Strapi in a production or production-like environment.

[CAD

Caddy

Overview of proxying Strapi with Caddy

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/optional-software/caddy-proxy.html)

[HAP

HAProxy

Overview of proxying Strapi with HAProxy

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/optional-software/haproxy-proxy.html)

[Deployment - 图9

Nginx

Overview of proxying Strapi with Nginx

](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/deployment/optional-software/nginx-proxy.html)

Recommended requirements

To provide the best possible environment for Strapi there are a few requirements, these apply in both a development (local) as well as a staging and production workflow.

  • Node LTS (v12 or V14) Note that odd-number releases of Node will never be supported (e.g. v13, v15).
  • NPM v6 or whatever ships with the LTS Node versions
  • Typical standard build tools for your OS (the build-essentials package on most Debian-based systems)
  • At least 1 CPU core (Highly recommended at least 2)
  • At least 2 GB of RAM (Moderately recommended 4)
  • Minimum required storage space recommended by your OS or 32 GB of free space
  • A supported database version
    • MySQL >= 5.6
    • MariaDB >= 10.1
    • PostgreSQL >= 10
    • SQLite >= 3
    • MongoDB >= 3.6
  • A supported operating system

Application Configuration

1. Configure

We always recommend you use environment variables to configure your application based on the environment. Here is an example:

Path — ./config/server.js.

  1. module.exports = ({ env }) => ({
  2. host: env('APP_HOST', '0.0.0.0'),
  3. port: env.int('NODE_PORT', 1337),
  4. });

Then you can create a .env file or directly use the deployment platform you use to set environment variables:

Path — .env.

  1. APP_HOST=10.0.0.1
  2. NODE_PORT=1338

TIP

To learn more about configuration you can read the documentation here

2. Launch the server

Before running your server in production you need to build your admin panel for production

  1. NODE_ENV=production yarn build
  1. NODE_ENV=production npm run build
  1. npm install cross-env

Then in your package.json scripts section:

  1. "production": "cross-env NODE_ENV=production npm run build"

Run the server with the production settings.

  1. NODE_ENV=production yarn start
  1. NODE_ENV=production npm start
  1. npm install cross-env

Then in your package.json scripts section:

  1. "production": "cross-env NODE_ENV=production npm start"

WARNING

We highly recommend using pm2 Deployment - 图11 (opens new window) to manage your process.

If you need a server.js file to be able to run node server.js instead of npm run start then create a ./server.js file as follows:

  1. const strapi = require('strapi');
  2. strapi(/* {...} */).start();

Advanced configurations

If you want to host the administration on another server than the API, please take a look at this dedicated section.