Skip to content
Snippets Groups Projects
Commit f7194f45 authored by jurgenhaas's avatar jurgenhaas
Browse files

Protect redis and memcached, add Varnish cache class and add fast404

parent d2747c4b
Branches
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ $conf['varnish_socket_timeout'] = '{{ varnish_socket_timeout }}';
$conf['varnish_version'] = '{{ varnish_version }}';
{% endif %}
if (file_exists('sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.autoload.inc')) {
if (file_exists('sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.autoload.inc') && extension_loaded('redis')) {
$conf['cache_backends'][] = 'sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.autoload.inc';
$conf['cache_default_class'] = 'Redis_Cache';
{% if drupal.jail is defined %}
......@@ -72,7 +72,7 @@ if (file_exists('sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.autolo
$conf['path_inc'] = 'sites/all/modules{{ drupal_contrib_subdir }}/redis/redis.path.inc';
$conf['redis_client_interface'] = 'PhpRedis';
}
else if (file_exists('sites/all/modules{{ drupal_contrib_subdir }}/memcache/memcache.inc')) {
else if (file_exists('sites/all/modules{{ drupal_contrib_subdir }}/memcache/memcache.inc') && extension_loaded('memcache')) {
$conf['cache_backends'][] = 'sites/all/modules{{ drupal_contrib_subdir }}/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
......@@ -85,6 +85,10 @@ else if (file_exists('sites/all/modules{{ drupal_contrib_subdir }}/memcache/memc
$conf['memcache_key_prefix'] = '{{ item.shortname|default("default") }}_';
{% endif %}
}
if (file_exists('sites/all/modules{{ drupal_contrib_subdir }}/varnish/varnish.cache.inc')) {
$conf['cache_backends'][] = 'sites/all/modules{{ drupal_contrib_subdir }}/varnish/varnish.cache.inc';
$conf['cache_class_external_varnish_page'] = 'VarnishCache';
}
{% if item.cloudflare|default(false) %}
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
......@@ -103,3 +107,81 @@ $conf['{{ config.key }}'] = {{ config.value }};
{% if item.multidomain|default(false) %}
include DRUPAL_ROOT . '/sites/all/modules{{ drupal_contrib_subdir }}/domain/settings.inc';
{% endif %}
{% if item.fast404 is defined %}
if (file_exists('./sites/all/modules{{ drupal_contrib_subdir }}/fast_404/fast_404.inc')) {
include_once('./sites/all/modules{{ drupal_contrib_subdir }}/fast_404/fast_404.inc');
$conf['fast_404_exts'] = '/[^robots]\.(txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i';
$conf['fast_404_allow_anon_imagecache'] = TRUE;
$conf['fast_404_exts'] = '/\.(txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp|php|html?)$/i';
$conf['fast_404_html'] = '<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>404 Not Found</title>
<style type="text/css">
html {
font-family: Verdana, Arial, sans-serif;
color: #333;
}
body {
margin: 0;
}
#navigation {
background: url("{{ item.fast404.bgimage }}") repeat-x scroll 0 0 #f8f7f7;
height: 65px;
position: relative;
-webkit-box-shadow: 0 2px 4px #777777;
-moz-box-shadow: 0 2px 4px #777777;
box-shadow: 0 2px 4px #777777;
z-index: 1;
}
#navigation img {
margin-top: 15px;
}
#content {
padding: 2.9%;
width: 320px;
}
.region-navigation, #content {
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 320px;
min-width: 300px;
}
h1 {
color: #005ca9;
font-size: 32px;
line-height: 32px;
font-weight: normal;
}
a {
color: #666;
text-decoration: none;
border-bottom 1px dotted #666;
}
a:hover {
background: #eee;
}
a:visited {
color: #666;
}
</style>
</head><body>
<div id="navigation"><div class="region-navigation"><a href="' . $base_url . '"><img src="' . $base_url . '{{ item.fast404.logo }}"/></a></div> </div>
<div id="content">
<img src="' . $base_url . '{{ item.fast404.image }}"/>
<h1>Sorry! That file doesn\'t exist.</h1><p>Return to <a href="' . $base_url . '/">Home</a></p></div></body></html>';
$conf['fast_404_path_check'] = FALSE;
$conf['fast_404_url_whitelisting'] = FALSE;
$conf['fast_404_whitelist'] = array(
'index.php',
'rss.xml',
'install.php',
'cron.php',
'update.php',
'xmlrpc.php'
);
$conf['fast_404_string_whitelisting'] = array('cdn/farfuture', '/advagg_');
$conf['fast_404_HTML_error_all_paths'] = TRUE;
}
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment