Skip to content

Server configuration

Configure a self-hosted Silex with environment variables.

Overview

Environment variables are the supported way to configure a self-hosted Silex — they control ports, URLs, connectors, limits and SSL, and cover the vast majority of setups. Start there.

To add GrapesJS editor plugins, you don't touch the server config — use the client config instead.

Silex also has an internal server config (the full SaaS setup: dashboard, onboarding, and the connectors wired from the env vars below). It ships with Silex and is loaded automatically — you don't edit it.

Prerequisites

Environment variables

All environment variables are optional except SILEX_SESSION_SECRET (recommended for security).

Core server settings

Variable Default Purpose
SILEX_PORT 6805 Port the server listens on
SILEX_HOST localhost Hostname (0.0.0.0 for remote access)
SILEX_PROTOCOL http http or https (before reverse proxy)
SILEX_URL ${PROTOCOL}://${HOST}:${PORT} Public URL users visit
SILEX_DEBUG false Set to true to reload the client config file on each request (dev only)
SILEX_SESSION_NAME silex-session Session cookie name
SILEX_SESSION_SECRET (none) Random key for session encryption; min 32 chars

Express request limits

For large file uploads or data:

Variable Default Purpose
SILEX_EXPRESS_JSON_LIMIT 100mb Max JSON body size
SILEX_EXPRESS_TEXT_LIMIT 100mb Max text body size
SILEX_EXPRESS_URLENCODED_LIMIT 100mb Max form-encoded body size

The defaults above come from the shipped .env.default. The Docker image overrides them to 1mb / 10mb / 1mb — raise them there if you upload large assets.

SSL/HTTPS

For HTTPS without a reverse proxy:

Variable Default Purpose
SILEX_SSL_PORT (none) HTTPS port (e.g., 443)
SILEX_SSL_PRIVATE_KEY (none) Path to private key file
SILEX_SSL_CERTIFICATE (none) Path to certificate file
SILEX_FORCE_HTTPS false Redirect HTTP to HTTPS
SILEX_FORCE_HTTPS_TRUST_XFP_HEADER false Trust X-Forwarded-Proto header from reverse proxy

CORS and client config

Variable Default Purpose
SILEX_CORS_URL (none) Allow requests from this origin (e.g., https://editor.example.com)
SILEX_CLIENT_CONFIG (none) Path to a client config file — see Client configuration to add GrapesJS plugins

Connectors

Variable Default Purpose
STORAGE_CONNECTORS fs Comma-separated list: gitlab. The default, fs, is for development only
HOSTING_CONNECTORS fs Comma-separated list: gitlab. The default, fs, is for development only
SILEX_FS_ROOT <cwd>/silex/storage Path for the fs storage connector (development only)
SILEX_FS_HOSTING_ROOT <cwd>/silex/hosting Path for the fs hosting connector (development only)
GITLAB_DISPLAY_NAME (none) Display name for the primary GitLab connector
GITLAB_DOMAIN (none) GitLab instance domain (e.g., gitlab.com)
GITLAB_CLIENT_ID (none) OAuth application ID for GitLab
GITLAB_CLIENT_SECRET (none) OAuth application secret for GitLab
GITLAB2_DISPLAY_NAME (none) Display name for a second GitLab connector
GITLAB2_DOMAIN (none) Domain for the second GitLab instance
GITLAB2_CLIENT_ID (none) OAuth application ID for second GitLab
GITLAB2_CLIENT_SECRET (none) OAuth application secret for second GitLab

See Storage connectors and Hosting connectors for how to choose connectors and set up GitLab OAuth.

NocoDB integration

Used only by the SaaS onboarding flow (server/deploy) to store sign-ups. Not needed for self-hosting — leave unset and onboarding stays disabled.

Variable Default Purpose
NOCO_URL (none) NocoDB instance URL
NOCO_API_KEY (none) NocoDB API key
NOCO_TABLE (none) NocoDB table name for website metadata

Extending the server

The connectors and options above are set with environment variables. To add your own server code, point SILEX_SERVER_CONFIG to a JavaScript file. This file is a Silex plugin: it can add routes, connectors, and react to server events. Silex loads it first, then its own config, server/deploy/.silex.js. See Using plugins and Creating plugins.

To extend the editor (blocks, panels, GrapesJS plugins), use the client config.

Troubleshooting

Connectors not loading

Verify the environment variables are set:

env | grep -E 'STORAGE_CONNECTORS|HOSTING_CONNECTORS|GITLAB'

At startup Silex logs each connector it adds (> Add storage connector from env var: …) — check the server logs to see what was actually loaded.

See also

Edit this page on GitLab