{"id":1244,"date":"2015-02-18T16:30:40","date_gmt":"2015-02-18T14:30:40","guid":{"rendered":"http:\/\/richardconsulting.ro\/blog\/?p=1244"},"modified":"2015-02-18T16:42:13","modified_gmt":"2015-02-18T14:42:13","slug":"install-and-configure-varnish-4-and-munin-plugin-for-wordpress-on-cpanelwhm-centos-6-servers","status":"publish","type":"post","link":"https:\/\/richardconsulting.ro\/blog\/2015\/02\/install-and-configure-varnish-4-and-munin-plugin-for-wordpress-on-cpanelwhm-centos-6-servers\/","title":{"rendered":"Install and configure Varnish 4 and Munin plugin for WordPress on cPanel\/WHM CentOS 6 servers"},"content":{"rendered":"<p>So you have a VPS with cPanel\/WHM (11.48) and want to run Varnish 4 reverse proxy to accelerate the server for your WordPress installations while monitoring Varnish 4 with Munin.<\/p>\n<p>1. Install Varnish 4 &#8211; just follow these instructions\u00a0<a href=\"https:\/\/www.varnish-cache.org\/installation\/redhat\">https:\/\/www.varnish-cache.org\/installation\/redhat<\/a><\/p>\n<p>2. Configure Varnish listening port to 80 by editing\u00a0<strong>\/etc\/sysconfig\/varnish<\/strong> file. In same file decide where to store the cache (on disk &#8211; default option, or on memory).<\/p>\n<p>3. Configure vcl files by following these instructions:\u00a0<a href=\"http:\/\/www.jaritimonen.com\/make-wordpress-faster-with-varnish-cache\/\">http:\/\/www.jaritimonen.com\/make-wordpress-faster-with-varnish-cache\/<\/a>\u00a0Please note that you should use the backend server <strong>public IP<\/strong> and a chosen port such as 8080 in the &lt;pre&gt;<span class=\"crayon-e\">backend<\/span> <span class=\"crayon-st\">default<\/span> <span class=\"crayon-sy\">{<\/span>}&lt;\/pre&gt; section. In default.vcl file just delete the websites filter (his wife&#8217;s websites) or modify them as necessary.<\/p>\n<p>4. Tweak settings for Apache in WHM and set non-SSL port to 8080 (or another port you chosen at step 3)<\/p>\n<p>5. Restart Apache and start varnish with <\/p>\n<pre>service varnish start<\/pre>\n<p>. If the varnish service does not start you need to debug your vcl files, most probably you introduced a typo. At this time you should be able to access all websites via varnish proxy. You can check it by accessing the WordPress websites and inspecting elements headers, you should be able to see Age and X-Varnish headers. Please do not login into backend of WordPress, the logged in users are not receiving cached files and Age header will always be 0.<\/p>\n<p>6. Download <strong>varnish4_<\/strong> plugin for Munin from here:\u00a0<a href=\"https:\/\/github.com\/munin-monitoring\/contrib\/tree\/master\/plugins\/varnish4\">https:\/\/github.com\/munin-monitoring\/contrib\/tree\/master\/plugins\/varnish4<\/a><\/p>\n<p>7. Edit the plugin file and change first line with: <\/p>\n<pre>#!\/usr\/local\/cpanel\/3rdparty\/perl\/514\/bin\/perl<\/pre>\n<p>8. Upload the file to munin plugins folder at\u00a0<strong>\/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins<\/strong> and make it executable (change permissions to 755)<\/p>\n<p>9. Create symlinks for all necessary aspects with these commands:<\/p>\n<pre>ln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_request_rate\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_hit_rate\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_backend_traffic\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_objects\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_transfer_rates\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_threads\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_memory_usage\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_uptime\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_session\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_expunge\r\nln -s \/usr\/local\/cpanel\/3rdparty\/share\/munin\/plugins\/varnish4_ \/etc\/munin\/plugins\/varnish4_ban<\/pre>\n<p>10. Edit\u00a0<strong>\/etc\/munin\/plugin-conf.d\/cpanel.conf<\/strong> file and add this section:<\/p>\n<pre>[varnish4_*]\r\nuser root\r\ngroup wheel\r\nenv.varnishstat varnishstat<\/pre>\n<p>11. restart munin by <\/p>\n<pre>service munin-node restart<\/pre>\n<p>12. After few minutes varnish graphs will appear in WHM under Munin plugin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So you have a VPS with cPanel\/WHM (11.48) and want to run Varnish 4 reverse proxy to accelerate the server for your WordPress installations while monitoring Varnish 4 with Munin. 1. Install Varnish 4 &#8211; just follow these instructions\u00a0https:\/\/www.varnish-cache.org\/installation\/redhat 2. Configure Varnish listening port to 80 by editing\u00a0\/etc\/sysconfig\/varnish file. In same file decide where to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[138,140,137,139],"class_list":["post-1244","post","type-post","status-publish","format-standard","hentry","category-wordpress-2","tag-cpanel","tag-munin","tag-varnish-4","tag-whm"],"_links":{"self":[{"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/posts\/1244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/comments?post=1244"}],"version-history":[{"count":1,"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/posts\/1244\/revisions"}],"predecessor-version":[{"id":1252,"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/posts\/1244\/revisions\/1252"}],"wp:attachment":[{"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/media?parent=1244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/categories?post=1244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/richardconsulting.ro\/blog\/wp-json\/wp\/v2\/tags?post=1244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}