eZ Documentation Center

This is outdated documentation made for eZ Publish Platform 5.2. It is being moved into the eZ Publish 5.x documentation, so please go there for most up-to-date documentation.

Skip to end of metadata
Go to start of metadata


This example demonstrates how to set up a virtual host on the Apache web server for an eZ Publish installation located in "/var/www/example". Let's say that we want to access eZ Publish by using the following URLs:

  • (actual website for public access)
  • (administration interface for the webmaster)

In order to achieve this, we need to set up both eZ Publish and the web server so that they respond correctly to the different requests.

eZ Publish configuration: siteaccess settings

eZ Publish needs to be configured to use the host access method. This can be done from within the web based setup wizard or by manually editing the global override for the site.ini configuration file: "<eZ Publish root>/ezpublish_legacy/settings/override/site.ini.append.php". A typical legacy configuration would look something like this:


This configuration tells eZ Publish that it should use the "example" siteaccess if a request starts with "" and "example_admin" if the request starts with "". For more information about site management in eZ Publish, please refer to the "Site management" part of the "Concepts and basics" chapter.

The legacy configuration above will only work if the same is also configured in Symfony, by adding our available siteaccesses and mapping our hosts to the desired siteaccess in ezpublish/config/ezpublish.yml. This approach is recommended!


A Symfony based eZ Publish 5 configuration would look something like this:



Apache configuration: virtual host settings

Assuming that...

  • eZ Publish is located in "/var/www/example"
  • the server's IP address is
  • we wish to access eZ Publish using "" and ""

...the following virtual host configuration needs to be added at the end of "http.conf":

    <Directory /var/www/example/web>
        Options FollowSymLinks
        AllowOverride None

    # Environment.
    # Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration
    # Defaults to "prod" if omitted
    SetEnv ENVIRONMENT "prod"

    # Whether to use Symfony's ApcClassLoader.
    # Possible values: 0 or 1
    # Defaults to 0 if omitted

    # Prefix used when USE_APC_CLASSLOADER is set to 1.
    # Use a unique prefix in order to prevent cache key conflicts
    # with other applications also using APC.
    # Defaults to "ezpublish" if omitted
    #SetEnv APC_CLASSLOADER_PREFIX "ezpublish"

    # Whether to use debugging.
    # Possible values: 0 or 1
    # Defaults to 0 if omitted, unless ENVIRONMENT is set to: "dev"

    # Whether to use Symfony's HTTP Caching.
    # Disable it if you are using an external reverse proxy (e.g. Varnish)
    # Possible values: 0 or 1
    # Defaults to 1 if omitted, unless ENVIRONMENT is set to: "dev"
    #SetEnv USE_HTTP_CACHE 1

    # Defines the proxies to trust.
    # Separate entries by a comma
    # Example: ","
    # By default, no trusted proxies are set
    <IfModule mod_php5.c>
        php_admin_flag safe_mode Off
        php_admin_value register_globals    0
        php_value magic_quotes_gpc  0
        php_value magic_quotes_runtime  0
        php_value allow_call_time_pass_reference 0
    DirectoryIndex index.php
    <IfModule mod_rewrite.c>
        RewriteEngine On
        # CVE-2012-6432
        RewriteRule ^/_internal - [R=403,L]
        # Uncomment in FastCGI mode, to get basic auth working.
        #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        # v1 rest API is on Legacy
        RewriteRule ^/api/[^/]+/v1/ /index_rest.php [L]
        # If using cluster, uncomment the following two lines:
        #RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /index_cluster.php [L]
        #RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* /index_cluster.php [L]
        RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* - [L]
        RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* - [L]
        RewriteRule ^/design/[^/]+/(stylesheets|images|javascript|fonts)/.* - [L]
        RewriteRule ^/share/icons/.* - [L]
        RewriteRule ^/extension/[^/]+/design/[^/]+/(stylesheets|flash|images|lib|javascripts?)/.* - [L]
        RewriteRule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
        RewriteRule ^/packages/styles/.+/thumbnail/.* - [L]
        RewriteRule ^/var/storage/packages/.* - [L]
        # Makes it possible to place your favicon at the root of your
        # eZ Publish instance. It will then be served directly.
        RewriteRule ^/favicon\.ico - [L]
        # Uncomment the line below if you want you favicon be served
        # from the standard design. You can customize the path to
        # favicon.ico by changing /design/standard/images/favicon\.ico
        #RewriteRule ^/favicon\.ico /design/standard/images/favicon.ico [L]
        RewriteRule ^/design/standard/images/favicon\.ico - [L]
        # Give direct access to robots.txt for use by crawlers (Google,
        # Bing, Spammers..)
        RewriteRule ^/robots\.txt - [L]
        # Platform for Privacy Preferences Project ( P3P ) related files
        # for Internet Explorer
        # More info here :
        RewriteRule ^/w3c/p3p\.xml - [L]
        # Uncomment the following lines when using popup style debug in legacy
        #RewriteRule ^/var/([^/]+/)?cache/debug\.html.* - [L]
        # Following rule is needed to correctly display assets from eZ Publish5 / Symfony bundles
        RewriteRule ^/bundles/ - [L]
        # Additional Assetic rules for eZ Publish 5.1 / 2013.4 and higher:
        ## Don't forget to run php ezpublish/console assetic:dump --env=prod
        ## and make sure to comment these out in dev environment.
        RewriteRule ^/css/.*\.css - [L]
        RewriteRule ^/js/.*\.js - [L]
        RewriteRule .* /index.php
    DocumentRoot /var/www/example/web

For instructions on how to set custom environments please refer to the Installing eZ Publish on a Linux-UNIX based system documentation page, under "Defining the desired environment".

Note that it isn't necessary to create a separate virtual host block for "", it can be added to the existing block using the "ServerAlias" directive which can take several values separated by a space.