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:
- http://www.example.com (actual website for public access)
- http://admin.example.com (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:
... [SiteAccessSettings] AvailableSiteAccessList AvailableSiteAccessList=example AvailableSiteAccessList=example_admin MatchOrder=host HostMatchMapItems=www.example.com;example HostMatchMapItems=admin.example.com;example_admin ...
This configuration tells eZ Publish that it should use the "
example" siteaccess if a request starts with "
www.example.com" and "
example_admin" if the request starts with "
admin.example.com". 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
- eZ Publish is located in "
- the server's IP address is
- we wish to access eZ Publish using "
www.example.com" and "
...the following virtual host configuration needs to be added at the end of "
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 "
admin.example.com", it can be added to the existing block using the "
ServerAlias" directive which can take several values separated by a space.