Advertisement
asanchez75

varnish/cpanel

Mar 25th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. http://www.cpanelkb.net/how-to-install-varnish-cache/
  2. How to install varnish cache on cpanel
  3. First, you need to change Apache listening port to another port 82 or anything else.
  4.  
  5. vi /etc/httpd/conf/httpd.conf
  6.  
  7. or you can change via WHM -> Tweak Settings -> set value of field Apache non-SSL IP/port to 82.
  8.  
  9. You can install varnish through YUM or manually download varnish RPM.
  10.  
  11. yum install varnish
  12.  
  13. or
  14.  
  15. for EL6
  16.  
  17. wget https://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-release/varnish-release-3.0-1.el6.noarch.rpm
  18.  
  19. rpm ivh varnish-release-3.0-1.el6.noarch.rpm
  20.  
  21. Once installation completed, Edit configuration file and change listening port to 80
  22.  
  23. vi /etc/sysconfig/varnish
  24.  
  25. VARNISH_LISTEN_PORT=80
  26.  
  27. Edit proxy settings in varnish
  28.  
  29. vi /etc/varnish/default.vcl or check with /usr/local/varnish/etc/varnish/vhost.vcl
  30.  
  31. backend default {
  32. .host = "184.82.165.4";
  33. .port = "82";
  34. }
  35.  
  36. sub vcl_recv {
  37. if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
  38. return(lookup);
  39. }
  40. }
  41.  
  42. # strip the cookie before the image is inserted into cache.
  43.  
  44. sub vcl_fetch {
  45. if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
  46. unset beresp.http.set-cookie;
  47. }
  48. }
  49. Enable chkconfig and restart varnish service
  50.  
  51. chkconfig varnish on
  52. service varnish start
  53.  
  54. Thats all… You can monitor varnish cache through this monitoring tool.
  55. #########################################################################################################
  56.  
  57. https://danielmiessler.com/blog/changing-your-server-headers-using-varnish/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement