Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Web server setup

Serve a DXP project with Apache 2.4 or Nginx and PHP-FPM, or the Symfony CLI for development - the document root, the rewrite to public/index.php, the APP_ENV, APP_DEBUG and APP_HTTP_CACHE settings, HTTPS and the reload…

Download as PDF

Address: https://doc.exponential.earth/learninminutes/exphelp/viewer/help/dxp-developers/web-server-setup.md

On this page

Web server setup

This page is for developers and administrators who put a DXP project behind a web server. The examples are the skeleton guide's (section 6), shortened; adapt host names and paths.

Contents

  1. What every setup needs
  2. Apache 2.4
  3. Nginx
  4. Symfony CLI for development
  5. HTTPS
  6. Reloading after a change

What every setup needs

  • The document root is public/, never the project root.
  • Every request that is not an existing file goes to public/index.php.
  • APP_ENV=prod, APP_DEBUG=0 on production. APP_HTTP_CACHE=1 turns on the Symfony HTTP cache; set it to 0 when Varnish caches in front (HTTP cache and Varnish).
  • No other .php file under public/ is executed.

Apache 2.4

Enable the modules: a2enmod rewrite deflate headers expires. Run Apache with the event MPM and PHP-FPM.

<VirtualHost *:80>
    ServerName exponential.local
    DocumentRoot /var/www/exponential/public
    DirectoryIndex index.php

    SetEnv APP_ENV "prod"
    SetEnv APP_DEBUG "0"
    SetEnv APP_HTTP_CACHE "1"

    <Directory /var/www/exponential/public>
        AllowOverride None
        Require all granted
        FallbackResource /index.php
    </Directory>
</VirtualHost>

Nginx

server {
    listen 80;
    server_name exponential.local;
    root /var/www/exponential/public;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/index\.php(/|$) {
        fastcgi_pass unix:/var/run/php/php8.3-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;
        fastcgi_param APP_ENV prod;
        fastcgi_param APP_DEBUG 0;
        fastcgi_param APP_HTTP_CACHE 1;
        internal;
    }

    location ~ \.php$ {
        return 404;
    }
}

Test and reload: nginx -t && systemctl reload nginx.

Symfony CLI for development

symfony server:start          # HTTPS on https://127.0.0.1:8000
symfony server:start -d       # in the background
symfony server:log
symfony server:stop

Do not use it in production.

HTTPS

Serve production over HTTPS only. The guide uses Certbot as one way to get a certificate (certbot --apache -d <your host>). Set TRUSTED_PROXIES when a proxy or Varnish terminates TLS in front of the application, so Symfony builds correct URLs.

Reloading after a change

ChangedCommand
Apache configurationsystemctl reload apache2
Nginx configurationsystemctl reload nginx
PHP-FPM settings or PHP code with OPcachesystemctl reload php8.3-fpm (your version's unit)
Application codeClear and warm the Symfony cache (Day-to-day commands)

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x