# Server configuration

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

# Available options

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

Parameter Description Type Default
host

❗️ Mandatory
Host name string localhost
port

❗️ Mandatory
Port on which the server should be running. integer 1337
socket Listens 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 Heroku nginx buildpack (opens new window)) string | integer /tmp/nginx.socket
emitErrors Enable errors to be emitted to koa when they happen in order to attach custom logic or use error reporting services. boolean false
url Public 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 ''
proxy Set the koa variable app.proxy. When true, proxy header fields will be trusted. boolean false
cron Cron configuration (powered by node-schedule (opens new window)) Object
cron.enabled Enable or disable CRON jobs to schedule jobs at specific dates. boolean false
cron.tasks Declare CRON jobs to be run at specific dates. boolean false

# Configurations

The ./config/server.js file should at least include a minimal configuration with the host and port parameters. Additional parameters can be included for a full configuration.

✏️ NOTE

Environmental configurations (i.e. using the env() helper) do not need to contain all the values so long as they exist in the default ./config/server.js.