{"id":3103,"date":"2014-01-13T19:26:30","date_gmt":"2014-01-13T19:26:30","guid":{"rendered":"http:\/\/blog.shineservers.com\/?p=2402"},"modified":"2014-01-13T19:26:30","modified_gmt":"2014-01-13T19:26:30","slug":"optimise-cpanelwhm-server","status":"publish","type":"post","link":"https:\/\/www.shineservers.com\/2014\/01\/13\/optimise-cpanelwhm-server\/","title":{"rendered":"Optimise cPanel\/WHM Server"},"content":{"rendered":"<p>In the optimization process we will go over the Apache core configuration and modules that are part of Apache core. We think that with the correct settings of Apache and MySQL you can get excellent results and the correct level of resource use without installing third-party\u00a0proxy and\u00a0cache modules. So let\u2019s start,<\/p>\n<p>&nbsp;<\/p>\n<p>In the first stage we run the Easy Apache and selected the following:<\/p>\n<p>* Apache Version 2+<\/p>\n<p>* PHP Version 5.3+<\/p>\n<p>* In step 5 \u201cExhaustive Options List\u201d select<\/p>\n<p>&#8211; Deflate<\/p>\n<p>&#8211; Expires<\/p>\n<p>&#8211; MPM Prefork<\/p>\n<p>&#8211; MPM Worker<\/p>\n<p>After\u00a0Easy Apache finished go to your WHM \u00bb Service Configuration \u00bb Apache Configuration \u00bb \u201cGlobal Configuration\u201d and set the values by the level of resources available on your server.<\/p>\n<pre>Apache Directive \t \t(From 2GB memory or less and up to 12GB memory) \t \t\n\nStartServers \t \t \t4 \t \t8 \t \t16 \t\nMinSpareServers \t \t4 \t \t8 \t \t16 \t\nMaxSpareServers \t \t8 \t \t16 \t \t32 \t\nServerLimit \t \t \t64 \t \t128 \t \t256 \t\nMaxClients \t \t \t50 \t \t120 \t \t250 \t\nMaxRequestsPerChild \t \t1000 \t \t2500 \t \t5000 \nKeep-Alive\t\t\tOn\t\tOn\t\tOn\nKeep-Alive Timeout\t \t5\t \t5\t \t 5\nMax Keep-Alive Requests\t\t50\t \t120\t \t120\nTimeout\t\t\t\t30\t\t60\t\t60<\/pre>\n<p>&nbsp;<\/p>\n<p>Now go to WHM \u00bb Service Configuration \u00bb Apache Configuration \u00bb Include Editor \u00bb \u201cPre VirtualHost Include\u201d and allow users minimal\u00a0cache and\u00a0data compression to allow the server to work less for the same things by pasting the code below into the text field.<\/p>\n<pre># Cache Control Settings for one hour cache\n&lt;FilesMatch \".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$\"&gt;\nHeader set Cache-Control \"max-age=3600, public\"\n&lt;\/FilesMatch&gt;\n\n&lt;FilesMatch \".(xml|txt)$\"&gt;\nHeader set Cache-Control \"max-age=3600, public, must-revalidate\"\n&lt;\/FilesMatch&gt;\n\n&lt;FilesMatch \".(html|htm)$\"&gt;\nHeader set Cache-Control \"max-age=3600, must-revalidate\"\n&lt;\/FilesMatch&gt;\n\n# Mod Deflate performs data compression\n&lt;IfModule mod_deflate.c&gt;\n&lt;FilesMatch \".(js|css|html|php|xml|jpg|png|gif)$\"&gt;\nSetOutputFilter DEFLATE\nBrowserMatch ^Mozilla\/4 gzip-only-text\/html\nBrowserMatch ^Mozilla\/4.0[678] no-gzip\nBrowserMatch bMSIE no-gzip\n&lt;\/FilesMatch&gt;\n&lt;\/IfModule&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>For MySQL you need to update the configuration file that\u00a0usually in \/etc\/my.cnf<\/p>\n<p>Best config base on 1 core &amp; 2GB memory MySQL 5.1:<\/p>\n<pre>[mysqld]\n    local-infile = 0\n    max_connections = 250\n    key_buffer = 64M\n    myisam_sort_buffer_size = 64M\n    join_buffer_size = 1M\n    read_buffer_size = 1M\n    sort_buffer_size = 2M\n    max_heap_table_size = 16M\n    table_cache = 5000\n    thread_cache_size = 286\n    interactive_timeout = 25\n    wait_timeout = 7000\n    connect_timeout = 15\n    max_allowed_packet = 16M\n    max_connect_errors = 10\n    query_cache_limit = 2M\n    query_cache_size = 32M\n    query_cache_type = 1\n    tmp_table_size = 16M\n[mysqld_safe]\n    open_files_limit = 4096\n[mysqldump]\n    quick\n    max_allowed_packet = 16M\n[myisamchk]\n    key_buffer = 64M\n    sort_buffer = 64M\n    read_buffer = 16M\n    write_buffer = 16M\n[mysqlhotcopy]\n    interactive-timeout<\/pre>\n<p>&nbsp;<\/p>\n<p>Best config base on 8 core &amp; 12GB memory MySQL 5.1:<\/p>\n<pre>[mysqld]\nlocal-infile=0\nsafe-show-database\ndefault-character-set=utf8\ndefault-collation=utf8_general_ci\nmax_connections = 600\nmax_user_connections=100\nkey_buffer_size = 512M\nmyisam_sort_buffer_size = 64M\nread_buffer_size = 1M\ntable_open_cache = 5000\nthread_cache_size = 384\nwait_timeout = 20\nconnect_timeout = 10\ntmp_table_size = 256M\nmax_heap_table_size = 128M\nmax_allowed_packet = 64M\nnet_buffer_length = 16384\nmax_connect_errors = 10\nconcurrent_insert = 2\n#table_lock_wait_timeout only for mysql5\ntable_lock_wait_timeout = 10\nread_rnd_buffer_size = 786432\nbulk_insert_buffer_size = 8M\nquery_cache_limit = 5M\nquery_cache_size = 128M\nquery_cache_type = 1\nquery_prealloc_size = 262144\nquery_alloc_block_size = 65536\ntransaction_alloc_block_size = 8192\ntransaction_prealloc_size = 4096\nmax_write_lock_count = 8\nslow_query_log\nexternal-locking=FALSE\nopen_files_limit=50000\n\n[mysqldump]\nquick\nmax_allowed_packet = 16M\n\n[isamchk]\nkey_buffer = 384M\nsort_buffer = 384M\nread_buffer = 256M\nwrite_buffer = 256M\n\n[myisamchk]\nkey_buffer = 384M\nsort_buffer = 384M\nread_buffer = 256M\nwrite_buffer = 256M#### Per connection configuration ####\nsort_buffer_size = 1M\njoin_buffer_size = 1M\nthread_stack = 192K<\/pre>\n<p>&nbsp;<\/p>\n<p>Then restart MySQL and the last step is limiting the use of resources.<\/p>\n<p>Go to WHM \u00bb Service Configuration \u00bb \u201cPHP Configuration Editor\u201d and set the parameters according to your needs:<\/p>\n<p>&#8211; memory_limit<\/p>\n<p>&#8211; max_execution_time<\/p>\n<p>&#8211; max_input_time<\/p>\n<p>&nbsp;<\/p>\n<p>Install\u00a0CSF (ConfigServer Security &amp; Firewall) at: http:\/\/configserver.com\/free\/csf\/install.txt<\/p>\n<p>And go to WHM \u00bb Plugins \u00bb ConfigServer Security &amp; Firewall \u00bb \u201cFirewall Configuration\u201d and set the parameters according to your needs:<\/p>\n<p>PT_USERMEM=180<\/p>\n<p>PT_USERTIME=180<\/p>\n<p>PT_USERKILL=1<\/p>\n<p>PT_USERKILL_ALERT=1 (Optional)<\/p>\n<p>&nbsp;<\/p>\n<p>Now enjoy your new fast and more effective server.<\/p>\n<h3 class=\"zemanta-related-title\" style=\"margin: 0 0 10px 0; padding: 0; clear: both;\">Related articles across the web<\/h3>\n<ul class=\"zemanta-article-ul zemanta-article-ul-image\" style=\"margin: 0; padding: 0; overflow: hidden;\">\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/moz.com\/blog\/15-tips-to-speed-up-your-website\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/187746364_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/moz.com\/blog\/15-tips-to-speed-up-your-website\" target=\"_blank\" rel=\"noopener noreferrer\">15 Tips to Speed Up Your Website<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/moz.com\/blog\/optimizing-page-speed-actionable-tips-for-seos-and-web-developers\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/187747334_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/moz.com\/blog\/optimizing-page-speed-actionable-tips-for-seos-and-web-developers\" target=\"_blank\" rel=\"noopener noreferrer\">Optimizing Page Speed &#8211; Actionable Tips For SEOs and Web Developers<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/moz.com\/blog\/seo-your-joomla-website-in-11-super-easy-steps\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/187746202_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/moz.com\/blog\/seo-your-joomla-website-in-11-super-easy-steps\" target=\"_blank\" rel=\"noopener noreferrer\">SEO Your Joomla! Website in 11 Super Easy Steps<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/onemoretech.wordpress.com\/2013\/12\/09\/mysql-memory-configurations\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/228676311_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/onemoretech.wordpress.com\/2013\/12\/09\/mysql-memory-configurations\/\" target=\"_blank\" rel=\"noopener noreferrer\">MySQL memory configurations<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>In the optimization process we will go over the Apache core configuration and modules that are part of Apache core. We think that with the correct settings of Apache and MySQL you can get excellent results and the correct level of resource use without installing third-party\u00a0proxy and\u00a0cache modules. So let\u2019s start, &nbsp; In the first [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[53],"tags":[],"class_list":["post-3103","post","type-post","status-publish","format-standard","hentry","category-general"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/3103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/comments?post=3103"}],"version-history":[{"count":0,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/3103\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/media?parent=3103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/categories?post=3103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/tags?post=3103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}