Sulu CMS Installation and Configuration (Symfony)
Sulu is installed as a Symfony project via Composer. It requires PHP 8.2+, MySQL/MariaDB or PostgreSQL, and understanding of the Webspaces concept. This is not WordPress — without Symfony knowledge, the installation process takes more time.
System Requirements
- PHP 8.2+ with extensions:
intl,gdorimagick,pdo_mysql/pdo_pgsql,xml,zip,curl - MySQL 8.0+ / MariaDB 10.6+ / PostgreSQL 14+
- Composer 2
- Node.js 18+ (for building the backoffice frontend)
Installation
composer create-project sulu/skeleton my-project
cd my-project
Configure .env.local:
APP_ENV=dev
APP_SECRET=your-secret-key-here
DATABASE_URL="mysql://sulu:[email protected]:3306/sulu_db?serverVersion=8.0"
# or PostgreSQL:
# DATABASE_URL="postgresql://sulu:[email protected]:5432/sulu_db?serverVersion=14&charset=utf8"
[email protected]
Database Initialization
# create database
php bin/console doctrine:database:create
# run Sulu migrations
php bin/console doctrine:migrations:migrate --no-interaction
# create first admin user
php bin/console sulu:security:user:create \
--firstName="Admin" \
--lastName="Admin" \
--username=admin \
[email protected] \
--locale=en \
--role=ROLE_SULU_ADMIN
# populate necessary Sulu data
php bin/console sulu:document:initialize
php bin/console sulu:phpcr:init
Sulu Configuration
# config/packages/sulu.yaml
sulu_core:
content:
structure:
default_type:
homepage: 'default'
page: 'default'
paths:
app:
path: '%kernel.project_dir%/config/templates'
type: 'page'
app_homepage:
path: '%kernel.project_dir%/config/templates'
type: 'home'
sulu_document_manager:
mapping:
- alias: 'page'
phpcr_type: 'sulu:page'
class: 'Sulu\Bundle\ContentBundle\Document\PageDocument'
sulu_media:
storage:
name: 'local'
options:
base_path: '%kernel.project_dir%/public/uploads/media'
base_url: '/uploads/media'
image_format_files:
- '%kernel.project_dir%/config/image-formats.xml'
Nginx Configuration
server {
listen 443 ssl http2;
server_name example.com en.example.com admin.example.com;
root /var/www/my-project/public;
index index.php;
ssl_certificate /etc/ssl/certs/example.com.crt;
ssl_certificate_key /etc/ssl/private/example.com.key;
client_max_body_size 50M;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
location /uploads/ {
expires 30d;
add_header Cache-Control "public, immutable";
}
}
Jackalope and PHPCR
Sulu uses PHPCR (PHP Content Repository) via Jackalope. By default, Jackalope Doctrine DBAL stores content in a relational database. Alternative is Jackrabbit (Java), but for most projects, DBAL is sufficient.
# config/packages/doctrine_phpcr.yaml
doctrine_phpcr:
session:
backend:
type: doctrinedbal
connection: default
caches:
meta: cache.app
nodes: cache.app
workspace: default
odm:
auto_mapping: true
auto_generate_proxy_classes: '%kernel.debug%'
Route Configuration
# config/routes_website.yaml
sulu_website:
resource: "@SuluWebsiteBundle/Resources/config/routing/website.xml"
type: xml
app_default:
path: /{slug}
requirements:
slug: .*
defaults:
_controller: Sulu\Bundle\WebsiteBundle\Controller\DefaultController::indexAction
# config/routes_admin.yaml
sulu_admin:
resource: "@SuluAdminBundle/Resources/config/routing/admin.xml"
prefix: /admin
sulu_core_api:
resource: "@SuluCoreBundle/Resources/config/routing/api.xml"
prefix: /api
app_admin:
resource: ../src/Controller/Admin/
type: annotation
prefix: /api
Building the Backoffice Frontend
# install dependencies
npm install
# development
npm run build:dev # or npm run watch
# production
npm run build
Sulu backoffice is a React application. Custom components are added via custom Bundles.
Caching and Performance
# warm up cache
php bin/console cache:warmup --env=prod
# clear PHPCR cache
php bin/console cache:clear
# task queue (Messenger)
php bin/console messenger:consume async --limit=100
For production, Redis is recommended as cache backend:
# config/packages/cache.yaml
framework:
cache:
default_redis_provider: 'redis://127.0.0.1:6379'
pools:
cache.app:
adapter: cache.adapter.redis
Deployment
# on server
composer install --no-dev --optimize-autoloader
npm ci && npm run build
php bin/console cache:warmup --env=prod
php bin/console doctrine:migrations:migrate --no-interaction --env=prod
Timeline
Basic installation with one Webspace, two languages, and first user: 1 day. With Nginx setup, Redis, Messenger, and initial template configuration: 2–3 days.







