forked from ezsystems/ezpublish-community
/
vhost.template
191 lines (156 loc) · 8.21 KB
/
vhost.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Official VirtualHost configuration for Apache 2.x
# Note: This is meant to be tailored for your needs, expires headers might for instance not work for dev.
# Params: %IP_ADDRESS%, %PORT%, %HOST%, %HOST_ALIAS%, %BASEDIR%, %ENV% and %PROXY%
# NameVirtualHost %IP_ADDRESS%
<VirtualHost %IP_ADDRESS%:%PORT%>
ServerName %HOST%
ServerAlias %HOST_ALIAS%
DocumentRoot %BASEDIR%/web
DirectoryIndex index.php
# Enabled for Dev environment
# LogLevel debug
<Directory %BASEDIR%/web>
Options FollowSymLinks
AllowOverride None
# depending on your global Apache settings, you may need to uncomment and adapt
# for Apache 2.2 and earlier:
#Allow from all
# for Apache 2.4:
#Require all granted
</Directory>
## eZ Publish ENVIRONMENT variables, used for customizing index.php execution (not used by console commands)
# Environment.
# Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration
# Defaults to "prod" if omitted (uses SetEnvIf so value can be used in rewrite rules)
SetEnvIf Request_URI ".*" ENVIRONMENT=%ENV%
# Whether to use custom ClassLoader (autoloader) file
# Needs to be a valid path relative to root web/ directory
# Defaults to bootstrap.php.cache, or autoload.php in debug, supported on 2015.01 and higher
#SetEnv CUSTOM_CLASSLOADER_FILE "../ezpublish/autoload.php"
# Whether to use Symfony's ApcClassLoader.
# Possible values: 0 or 1
# Defaults to 0 if omitted, supported on 5.2 and higher
#! Not supported as of 2015.01, use CUSTOM_CLASSLOADER_FILE instead for this.
#SetEnv USE_APC_CLASSLOADER 0
# 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, supported on 5.2 and higher
#! Not supported as of 2015.01, use CUSTOM_CLASSLOADER_FILE instead for this.
#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", supported on 5.2 and higher
#SetEnv USE_DEBUGGING 0
# 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", supported on 5.2 and higher
#SetEnv USE_HTTP_CACHE 1
# Whether to use custom HTTP Cache class if USE_HTTP_CACHE is enabled
# Value must be a autoloadable cache class
# Defaults to to use "EzPublishCache", supported on 2015.01 and higher
#SetEnv HTTP_CACHE_CLASS "\Vendor\Project\MyCache"
# Defines the proxies to trust.
# Separate entries by a comma
# Example: "proxy1.example.com,proxy2.example.org"
# By default, no trusted proxies are set, supported on 5.2 and higher
#SetEnv TRUSTED_PROXIES "%PROXY%"
<IfModule mod_rewrite.c>
RewriteEngine On
# Uncomment in FastCGI mode or when using PHP-FPM, to get basic auth working.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Needed for ci testing, remove in prod.
RewriteCond %{REQUEST_URI} ^/php5-fcgi(.*)
RewriteRule . - [L]
# v1 rest API is on Legacy
RewriteRule ^/api/[^/]+/v1/ /index_rest.php [L]
# If using cluster, uncomment the following two lines:
## For 5.4 and higher:
#RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /index.php [L]
#RewriteRule ^/var/([^/]+/)?cache/(texttoimage|public)/.* /index_cluster.php [L]
## Versions prior to 5.4:
#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 your 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 : http://en.wikipedia.org/wiki/P3p
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 environments different from dev,
# remember to run php ezpublish/console assetic:dump --env=prod
RewriteCond %{ENV:ENVIRONMENT} !("dev")
RewriteRule ^/(css|js|font)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L]
# Conditions for enabling webdav and soap interfaces from legacy
## Symlink files into your web folder and correct domain names to be valid server aliases
#RewriteCond %{HTTP_HOST} ^webdav\..*
#RewriteRule ^(.*) /webdav.php [L]
#RewriteCond %{HTTP_HOST} ^soap\..*
#RewriteRule ^(.*) /soap.php [L]
# For 5.x versions prior to 5.2, enable this to use dev env based on ENVIRONMENT variable set above
#RewriteCond %{ENV:ENVIRONMENT} "dev"
#RewriteRule .* /index_dev.php [L]
RewriteRule .* /index.php
</IfModule>
# Everything below is optional to improve performance by forcing
# clients to cache image and design files, change the expires time
# to suite project needs.
<IfModule mod_expires.c>
<LocationMatch "^/var/[^/]+/storage/images/.*">
# eZ Publish appends the version number to image URL (ezimage
# datatype) so when an image is updated, its URL changes to
ExpiresActive on
ExpiresDefault "now plus 10 years"
</LocationMatch>
<LocationMatch "^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?|flash)/.*">
# A good optimization if you don't change your design often
ExpiresActive on
ExpiresDefault "now plus 5 days"
</LocationMatch>
<LocationMatch "^/extension/[^/]+/design/[^/]+/lib/.*">
# Libraries get a new url (version number) on updates
ExpiresActive on
ExpiresDefault "now plus 90 days"
</LocationMatch>
<LocationMatch "^/design/[^/]+/(stylesheets|images|javascripts?|lib|flash)/.*">
# Same as above for bundled eZ Publish designs
ExpiresActive on
ExpiresDefault "now plus 7 days"
</LocationMatch>
<LocationMatch "^/share/icons/.*">
# Icons as used by admin interface, barly change
ExpiresActive on
ExpiresDefault "now plus 7 days"
</LocationMatch>
# When ezjscore.ini/[Packer]/AppendLastModifiedTime=enabled
# so that file names change when source files are modified
#<LocationMatch "^/var/[^/]+/cache/public/.*">
# Force ezjscore packer js/css files to be cached 30 days
# at client side
#ExpiresActive on
#ExpiresDefault "now plus 30 days"
#</LocationMatch>
</IfModule>
</VirtualHost>