Install Varnish in Drupal 7
Learn Installation of Varnish Cache Server for Drupal 7 in few Steps.
1.Update Apt-get
2.Install Varnish
3.Edit your Varnish Page
Add this to the top of the file to start varnishd at boot:
Then look for these settings and edit to match:
4. Now Edit ports.conf file
Update settings to match:
4. Also Edit default file
Update settings to match:
5. Restart Apache2 and Varnish Servers
6. Update default.vcl file
5. Restart Apache2 and Varnish Servers
6. Download Drupal Varnish Module from the below URI
https://drupal.org/project/varnish
Add the followint to sites/default/settings.php
1.Update Apt-get
sudo apt-get update
2.Install Varnish
sudo apt-get install varnish
3.Edit your Varnish Page
sudo vi /etc/default/varnish
Add this to the top of the file to start varnishd at boot:
START=yes
Then look for these settings and edit to match:
DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,128M"
4. Now Edit ports.conf file
sudo vi /etc/apache2/ports.conf
Update settings to match:
NameVirtualHost *:8080 Listen 8080
4. Also Edit default file
sudo vi /etc/apache2/sites-availbable/default
Update settings to match:
<VirtualHost *:8080>
5. Restart Apache2 and Varnish Servers
sudo service apache2 restart
sudo service varnish restart
6. Update default.vcl file
sudo vi /etc/varnish/default.vcl
backend default {
.host = "127.0.0.1";
.port = "8080";
.max_connections = 250;
.connect_timeout = 300s;
.first_byte_timeout = 300s;
.between_bytes_timeout = 300s;
}
5. Restart Apache2 and Varnish Servers
sudo service apache2 restart
sudo service varnish restart
6. Download Drupal Varnish Module from the below URI
https://drupal.org/project/varnish
Add the followint to sites/default/settings.php
$conf['cache_backends'][] = 'sites/all/modules/varnish/varnish.cache.inc';
$conf['cache_class_cache_page'] = 'VarnishCache';
$conf['reverse_proxy'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;
$conf['cache'] = 1;
$conf['cache_lifetime'] = 0;
$conf['page_cache_maximum_age'] = 21600;
$conf['reverse_proxy_header'] = 'HTTP_X_FORWARDED_FOR';
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
$conf['omit_vary_cookie'] = TRUE;
Comments
Post a Comment