Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://www.cpanelkb.net/how-to-install-varnish-cache/
- How to install varnish cache on cpanel
- First, you need to change Apache listening port to another port 82 or anything else.
- vi /etc/httpd/conf/httpd.conf
- or you can change via WHM -> Tweak Settings -> set value of field Apache non-SSL IP/port to 82.
- You can install varnish through YUM or manually download varnish RPM.
- yum install varnish
- or
- for EL6
- wget https://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm
- rpm ivh varnish-release-3.0-1.el6.noarch.rpm
- Once installation completed, Edit configuration file and change listening port to 80
- vi /etc/sysconfig/varnish
- VARNISH_LISTEN_PORT=80
- Edit proxy settings in varnish
- vi /etc/varnish/default.vcl or check with /usr/local/varnish/etc/varnish/vhost.vcl
- backend default {
- .host = "184.82.165.4";
- .port = "82";
- }
- sub vcl_recv {
- if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
- return(lookup);
- }
- }
- # strip the cookie before the image is inserted into cache.
- sub vcl_fetch {
- if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
- unset beresp.http.set-cookie;
- }
- }
- Enable chkconfig and restart varnish service
- chkconfig varnish on
- service varnish start
- Thats all… You can monitor varnish cache through this monitoring tool.
- #########################################################################################################
- https://danielmiessler.com/blog/changing-your-server-headers-using-varnish/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement