Message-ID: <1704437759.4108.1485857351775.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4107_1777711755.1485857351775" ------=_Part_4107_1777711755.1485857351775 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This example demonstrates how to set up a virtual host on the Ap=
ache web server for an eZ Publish installation located in "/var/www/e=
xample
". Let's say that we want to access eZ Publish by using the fo=
llowing 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 ca=
n 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[]=3Dexample AvailableSiteAccessList[]=3Dexample_admin MatchOrder=3Dhost =20 HostMatchMapItems[]=3Dwww.example.com;example HostMatchMapItems[]=3Dadmin.example.com;example_admin ...=20
This configuration tells eZ Publish that it should use the "exampl=
e
" 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 Publi=
sh, please refer to the "Site management" part of the "Concepts and b=
asics" chapter.
The legacy configuration above will only work if the same is also config= ured 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 thi= s:
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 s= uffice). matchers: Map\URI: the_front: true Map\Host: ezpublish.dev: true # The siteaccess to match in the end match: ezdemo_site=20 - 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=20
Assuming that...
/var/www/example
"
128.39.140.28
www.example.com
" and "
admin.example.com
"
...the following virtual host configuration needs to be added at the end=
of "http.conf
":
NameVirtualHost 128.39.140.28 =20 <VirtualHost 128.39.140.28> <Directory /var/www/example/web> Options FollowSymLinks AllowOverride None </Directory> =20 <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 </IfModule> =20 DirectoryIndex index.php =20 <IfModule mod_rewrite.c> RewriteEngine On =20 # CVE-2012-6432 RewriteRule ^/_internal - [R=3D403,L] =20 # Uncomment in FastCGI mode, to get basic auth working. #RewriteRule .* - [E=3DHTTP_AUTHORIZATION:%{HTTP:Authorization}] # v1 rest API is on Legacy RewriteRule ^/api/[^/]+/v1/ /index_rest.php [L] =20 # If using cluster, uncomment the following two lines: #RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /index_c= luster.php [L] #RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* /index_cl= uster.php [L] =20 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|image= s|lib|javascripts?)/.* - [L] RewriteRule ^/packages/styles/.+/(stylesheets|images|javascript)/[^= /]+/.* - [L] RewriteRule ^/packages/styles/.+/thumbnail/.* - [L] RewriteRule ^/var/storage/packages/.* - [L] =20 # 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] =20 # Give direct access to robots.txt for use by crawlers (Google, # Bing, Spammers..) RewriteRule ^/robots\.txt - [L] =20 # Platform for Privacy Preferences Project ( P3P ) related files # for Internet Explorer # More info here : http://en.wikipedia.org/wiki/P3p RewriteRule ^/w3c/p3p\.xml - [L] =20 # Uncomment the following lines when using popup style debug in leg= acy #RewriteRule ^/var/([^/]+/)?cache/debug\.html.* - [L] =20 # Following rule is needed to correctly display assets from eZ Publ= ish5 / Symfony bundles RewriteRule ^/bundles/ - [L] # Additional Assetic rules for eZ Publish 5.1 / 2013.4 and higher: RewriteRule ^/css/.*\.css - [L] RewriteRule ^/js/.*\.js - [L] =20 # For dev/debug environment, you might want to use the 'development= ' front controller. # Uncomment the 'RewriteRule' line below to use it. # The following example 'RewriteCond' lines can be used in combinat= ion to conditionally use it. #RewriteCond %{HTTP_HOST} =3D dev.example.com [OR] #RewriteCond %{HTTP_HOST} =3D dev.admin.example.com #RewriteRule .* /index_dev.php [L] # Redirect all requests to the 'production' front controller RewriteRule .* /index.php </IfModule> =20 DocumentRoot /var/www/example/web ServerName www.example.com ServerAlias admin.example.com </VirtualHost>=20
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 us=
ing the "ServerAlias
" directive which can take sever=
al values separated by a space.