Skip to main content

strapi-server

Strapi server

In order to take full advantage of a proxied Strapi application, Strapi should be configured so it's aware of the upstream proxy. Like with the below configurations there are 3 matching examples. Additional information can be found in the server configuration and admin configuration documentations.

✏️ Note

These examples use the default API Prefix of /api. This can be changed without the need to directly modify the Nginx configuration (see the API prefix documentation).

Caution

If the url key is changed in the ./config/admin.js or ./config/server.js files, the admin panel needs to be rebuilt with yarn build or npm run build.

Subdomain Strapi configuration


  • Example domain: api.example.com
  • Example admin: api.example.com/admin
  • Example API: api.example.com/api
  • Example uploaded files (local provider): api.example.com/uploads
path: ./config/server.js

module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: 'https://api.example.com',
});