Skip to content

Instantly share code, notes, and snippets.

@nghuuphuoc
Last active August 29, 2015 13:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nghuuphuoc/10514380 to your computer and use it in GitHub Desktop.
Save nghuuphuoc/10514380 to your computer and use it in GitHub Desktop.
Install Nexcessnet_Turpentine for Magento
1) Install Varnish first
https://gist.github.com/nghuuphuoc/7819928
2) Install Nexcessnet_Turpentine
$ cd <Magento directory>
$ chmod 755 mage
$ ./mage install connect20.magentocommerce.com/community Nexcessnet_Turpentine
Checking dependencies of packages
Starting to download Nexcessnet_Turpentine-0.6.0.tgz ...
...done: 59,467 bytes
Installing package community/Nexcessnet_Turpentine 0.6.0
Package community/Nexcessnet_Turpentine 0.6.0 installed successfully
Package installed: community/Nexcessnet_Turpentine 0.6.0
3) Sign in to the Magento back-end
* Go to System > Configuration
* Choose TURPENTINE > Varnish option from the left
General Options > Apply VCL On Config Change -> Enable
General Options > Enable AJAX Flash Messages -> Enable
Servers > Varnish version -> choose the Varnish version installed on the server
Servers > Server List ->
{IP server}:6082
127.0.0.1:6082
Click Save Config button
* Choose TURPENTINE > Caching Options from the left
Backend > Backend Host -> 127.0.0.1
Backend > Backend Port -> 8080
Backend > Frontend Timeout -> 43200
Click Save Config button
* Go to System > Cache Management
Clear the Config, Layout, and Block HTML caches
Disable the Full Page Cache cache
Click the Download Varnish Config button, save the file and upload to /etc/varnish/default.vcl
* It seems that there is issue of Nexcessnet_Turpentine 0.6.0 when generating the Varnish config file
sub vcl_recv {
if (!true || req.http.Authorization ...
# --> change to if (!false || req.http.Authorization ...
}
4) Modify /etc/varnish/default.vcl
* Add the following section to the end of sub vcl_deliver section:
if (obj.hits > 0) {
set resp.http.X-Varnish-Cache = "hit";
set resp.http.X-Varnish-Hits = obj.hits;
} else {
set resp.http.X-Varnish-Cache = "miss";
}
5) Change the ports:
* /etc/sysconfig/varnish:
VARNISH_LISTEN_PORT=80
# Add more params (https://github.com/nexcess/magento-turpentine/wiki/Installation)
DAEMON_OPTS="...
-p esi_syntax=0x2 \
-p cli_buffer=16384 \
..."
* /etc/nginx/conf.d/yousite.conf
server {
listen 8080;
}
* Restart Varnish and Nginx:
$ service nginx restart
$ /etc/init.d/varnish restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment