forked from ezsystems/ezplatform
/
vhost.template
115 lines (90 loc) · 5.24 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
# Official VirtualHost configuration for Apache 2.4 template
# See Readme.md for how to generate your config manually, or in automated deployments.
# Note: This is meant to be manually tailored for your needs, expires headers might for instance not work for your dev setup.
# NameVirtualHost %IP_ADDRESS%
<VirtualHost %IP_ADDRESS%:%PORT%>
ServerName %HOST_NAME%
ServerAlias %HOST_ALIAS%
DocumentRoot %BASEDIR%/web
DirectoryIndex app.php
# Request size limit in bytes, 0 to disable
LimitRequestBody %BODY_SIZE_LIMIT%
# Request timeout limit in seconds, 0 to disable
TimeOut %TIMEOUT%
# Enabled for Dev environment
#LogLevel debug
# "web" folder is what we expose to the world, all rewrite rules further down is relative to it.
<Directory %BASEDIR%/web>
<FilesMatch \.php$>
# For serving php files configure mod_proxy to talk to php-fpm using Apache 2.4.10 and higher.
# See: https://wiki.apache.org/httpd/PHP-FPM#apache_httpd_2.4
# For best performance, prefer socket use. This requires Linux, and that both Apache and PHP has access to
# the socket file `/var/run/php5-fpm.sock` via local file system and hence run on the same machine.
#SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
# For TCP usage, if you're not on Linux, or Apache and PHP are on separate machines, instead use fcgi: form.
# (Optionally hint php-fpm processes count using: https://wiki.apache.org/httpd/PHP-FPM#Proxy_via_handler)
#SetHandler "proxy:fcgi://localhost/:9000"
SetHandler "proxy:%FASTCGI_PASS%|fcgi://localhost/"
</FilesMatch>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
## eZ Platform/Symfony ENVIRONMENT variables, for customizing app.php* execution
# * Only SYMFONY_ENV and SYMFONY_DEBUG supported by console command, rest are eZ Platform features in app.php.
# 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)
#if[SYMFONY_ENV] SetEnvIf Request_URI ".*" SYMFONY_ENV=%SYMFONY_ENV%
# Optional: Whether to use debugging.
# Possible values: 0, 1 or ""
# Defaults to enabled if SYMFONY_ENV is set to "dev" if env value is omitted or empty
#if[SYMFONY_DEBUG] SetEnv SYMFONY_DEBUG "%SYMFONY_DEBUG%"
# Optional: Whether to use Symfony's builtin HTTP Caching Proxy.
# Disable it if you are using an external reverse proxy (e.g. Varnish)
# Possible values: 0, 1 or ""
# Defaults to disabled if SYMFONY_ENV is set to "dev" or SYMFONY_TRUSTED_PROXIES is set,
# and if this env value is omitted or empty
#if[SYMFONY_HTTP_CACHE] SetEnv SYMFONY_HTTP_CACHE "%SYMFONY_HTTP_CACHE%"
# Optional: Defines the proxies to trust
# Needed when using Varnish as proxy, if so disable SYMFONY_HTTP_CACHE.
# Separate entries by a comma, example: "ip1,ip2"
# Defaults to not be set if env value is omitted or empty
#if[SYMFONY_TRUSTED_PROXIES] SetEnv SYMFONY_TRUSTED_PROXIES "%SYMFONY_TRUSTED_PROXIES%"
# TIP: There are many more environment variables supported by eZ Platform. However unlike those listed above
# they should in most cases rather be set in the environment then in vhost config to make sure cronjobs
# and cli command usage takes them into account as well.
<IfModule mod_rewrite.c>
RewriteEngine On
# For FastCGI mode or when using PHP-FPM, to get basic auth working.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Cluster/streamed files rewrite rules. Enable on cluster with DFS as a binary data handler
RewriteCond %{ENV:BINARY_DATA_HANDLER} "dfs"
RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /app.php [L]
RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* - [L]
# Makes it possible to placed your favicon and robots.txt at the root of your web folder
RewriteRule ^/favicon\.ico - [L]
RewriteRule ^/robots\.txt - [L]
# The following rules are needed to correctly display bundle and project assets
RewriteRule ^/bundles/ - [L]
RewriteRule ^/assets/ - [L]
# Additional Assetic rules for environments different from dev,
# remember to run php app/console assetic:dump --env=prod
RewriteCond %{ENV:SYMFONY_ENV} !^(dev)
RewriteRule ^/(css|js|fonts?)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L]
# Prevent access to website with direct usage of app.php in URL
RewriteRule ^/(.+/)?app\.php - [R=404,L]
RewriteRule .* /app.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 Platform appends the version number to image URL (ezimage
# datatype) so when an image is updated, its URL changes too
ExpiresActive on
ExpiresDefault "now plus 10 years"
</LocationMatch>
</IfModule>
</VirtualHost>