Documents
server
server
Type
External
Status
Published
Created
Mar 5, 2026
Updated
Mar 5, 2026

Server configuration#

`/config/server` manages host, port, URL, proxy, cron, and more; changes require rebuilding the admin panel.

The /config/server.js file is used to define the server configuration for a Strapi application.

Changes to the server.js file require rebuilding the admin panel. After saving the modified file run either yarn build or npm run build in the terminal to implement the changes.

Available options#

The ./config/server.js file can include the following parameters:

ParameterDescriptionTypeDefault
host

❗️ Mandatory
Host namestringlocalhost
port

❗️ Mandatory
Port on which the server should be running.integer1337
app.keys

❗️ Mandatory
Declare session keys (based on ), which is used by the session middleware for the Users & Permissions plugin and the Documentation plugin.array of stringsundefined
socketListens on a socket. Host and port are cosmetic when this option is provided and likewise use url to generate proper urls when using this option. This option is useful for running a server without exposing a port and using proxy servers on the same machine (e.g )string | integer/tmp/nginx.socket
emitErrorsEnable errors to be emitted to koa when they happen in order to attach custom logic or use error reporting services.booleanfalse
urlPublic url of the server. Required for many different features (ex: reset password, third login providers etc.). Also enables proxy support such as Apache or Nginx, example: https://mywebsite.com/api. The url can be relative, if so, it is used with http://${host}:${port} as the base url. An absolute url is however recommended.string''
proxyProxy configurationobject
proxy.globalDefines the proxy agent for all external requests. To be used if the Strapi project is behind a forward proxy.string
proxy.fetchThe proxy for all requests made within strapi.fetch (used for licenses check, telemetry and webhooks)string |
proxy.httpThe proxy for all (non-fetch) http requestsstring
proxy.httpsThe proxy for all (non-fetch) https requestsstring
proxy.koaSet the koa variable app.proxy. When true, proxy header fields will be trusted.booleanfalse
cronCron configuration (powered by )object
cron.enabledEnable or disable CRON jobs to schedule jobs at specific dates.booleanfalse
cron.tasksDeclare CRON jobs to be run at specific dates.object
dirsPath configuration of different directories Strapi uses.object
dirs.publicCustomize the path of the public folder.string./public
httpConfiguration of the http server used by Strapiobject
http.serverOptionsOptions passed to http createServer{}
transfer.remote.enabledToggle the ability to use the transfer featurebooleantrue
logger.startup.enabledToggle the the startup message in the terminalbooleantrue
logger.updates.enabledToggle the notification message about updating strapi in the terminalbooleantrue

Configurations#

The ./config/server.js minimal configuration requires the host and port parameters for development. Additional parameters can be included for a full configuration.

The default configuration created with any new project should at least include the following:

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  app: {
    keys: env.array('APP_KEYS'),
  },
});
export default ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  app: {
    keys: env.array('APP_KEYS'),
  },
});

The following is an example of a full configuration file. Not all of these keys are required (see available options).

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  app: {
    keys: env.array('APP_KEYS'),
  },
  socket: '/tmp/nginx.socket', // only use if absolutely required
  emitErrors: false,
  url: env('PUBLIC_URL', 'https://api.example.com'),
  proxy: { koa: env.bool('IS_PROXIED', true) },
  cron: {
    enabled: env.bool('CRON_ENABLED', false),
  },
  transfer: {
    remote: {
      enabled: false,
    },
  },
  logger: {
    updates: {
      enabled: false,
    },
    startup: {
      enabled: false,
    },
  },
});
export default ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  app: {
    keys: env.array('APP_KEYS'),
  },
  socket: '/tmp/nginx.socket', // only use if absolutely required
  emitErrors: false,
  url: env('PUBLIC_URL', 'https://api.example.com'),
  proxy: { koa: env.bool('IS_PROXIED', true) },
  cron: {
    enabled: env.bool('CRON_ENABLED', false),
  },
  transfer: {
    remote: {
      enabled: false,
    },
  },
  logger: {
    updates: {
      enabled: false,
    },
    startup: {
      enabled: false,
    },
  },
});