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:
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 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:
ezpublish: siteaccess: default_siteaccess: ezdemo_site list: - ezdemo_site - eng - fre - fr_eng - ezdemo_site_admin groups: ezdemo_site_group: - ezdemo_site - eng - fre - fr_eng - ezdemo_site_admin match: Map\URI: ezdemo_site: ezdemo_site fre: fre ezdemo_site_admin: ezdemo_site_admin # The following mimics host_uri for 2 different configuration. Compound\LogicalAnd: - # Nested matchers, with their configuration. # No need to precise their matching values (true will suffice). matchers: Map\URI: the_front: true Map\Host: ezpublish.dev: true # The siteaccess to match in the end match: ezdemo_site - matchers: Map\URI: the_admin: true Map\Host: ezpublish.dev: true match: ezdemo_site_admin # Matching hosts as host: siteaccess Map\Host: ezpublish.dev: ezdemo_site admin.ezpublish.dev: ezdemo_site_admin
www.example.com" and "
...the following virtual host configuration needs to be added at the end of "
Note that it isn't necessary to create a separate virtual host block for "