{"id":30053,"date":"2019-10-31T21:33:26","date_gmt":"2019-10-31T18:33:26","guid":{"rendered":"https:\/\/prohoster.info\/blog\/optimizatsiya-proizvoditelnosti-apache2\/"},"modified":"2019-10-31T21:33:26","modified_gmt":"2019-10-31T18:33:26","slug":"optimizatsiya-proizvoditelnosti-apache2","status":"publish","type":"post","link":"https:\/\/prohoster.info\/nl\/blog\/optimizatsiya-proizvoditelnosti-apache2","title":{"rendered":"Optimalisatie van de prestaties van apache2","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Veel mensen gebruiken apache2 als webserver. Echter, weinig mensen denken na over het optimaliseren van de prestaties, wat een directe invloed heeft op de laadtijd van webpagina's, de verwerkingssnelheid van scripts (met name PHP), en leidt tot een hogere belasting van de CPU en een toename van het gebruikte RAM. <\/p>\n<p>Daarom zou de volgende handleiding beginnende (en niet alleen) gebruikers moeten helpen.<br \/>\nAlle onderstaande voorbeelden zijn gebruikt op een Raspberry PI 3, Debian 9, Apache 2.4.38, PHP 7.3.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nLaten we beginnen.<\/p>\n<h3>1. Uitschakelen van ongebruikte modules<\/h3>\n<p>\nDe eerste methode is eenvoudigweg ongebruikte modules uit te schakelen:<\/p>\n<p>Een lijst van momenteel gebruikte modules kan worden bekeken met het commando:<\/p>\n<pre><code class=\"bash\">apache2ctl -M<\/code><\/pre>\n<p>\nOm een module uit te schakelen, gebruik je het commando:<\/p>\n<pre><code class=\"bash\">a2dismod *module naam*<\/code><\/pre>\n<p>\nOm een module weer in te schakelen, gebruik je het commando:<\/p>\n<pre><code class=\"bash\">a2enmod *module naam*<\/code><\/pre>\n<p>\nLet op dat bij het gebruik van <i>a2dismod<\/i>, de module naam zonder het woord module moet worden geschreven.<\/p>\n<p>Bijvoorbeeld, als je in de uitvoer van het commando <i>apache2ctl -M<\/i> de naam <i>proxy_module<\/i>, hebt gezien, moet je het volgende commando gebruiken om het uit te schakelen \u2014 <i>a2dismod proxy<\/i><\/p>\n<p>De meest systeembelastende modules (uit persoonlijke ervaring) zijn:<\/p>\n<ul>\n<li>PHP, Ruby, Perl en andere modules voor verschillende scripttalen<\/li>\n<li><a class=\"wpil_keyword_link\" href=\"https:\/\/prohoster.info\/nl\/ssl-sertifikat\/\"   title=\"SSL\" data-wpil-keyword-link=\"linked\"  data-wpil-monitor-id=\"2258\">SSL<\/a><\/li>\n<li>Rewrite<\/li>\n<li>CGI<\/li>\n<\/ul>\n<p>\nDus in die gevallen waarin je deze modules niet nodig hebt, raad ik aan deze modules uit te schakelen.<\/p>\n<p>Daarnaast raad ik na het uitschakelen van een module aan om het commando \u2014 <i>apache2ctl configtest<\/i>, te gebruiken, wat de configuratie van de gebruikte sites controleert en als een van de uitgeschakelde modules daarvoor nodig was, een foutmelding geeft.<\/p>\n<h3>2. Wijziging van MPM (Multi-Processing Module) en gebruik van php-fpm<\/h3>\n<p>\nStandaard gebruikt apache2 na installatie MPM Prefork (1 draad per verbinding), wat de prestaties aanzienlijk verlaagt, maar tegelijkertijd stabiliteit en veiligheid verbetert.<\/p>\n<p>Maar voor prestatieoptimalisatie raad ik aan om MPM Worker te gebruiken, dat meerdere threads per verbinding mogelijk maakt.<\/p>\n<p>Om het in te schakelen, gebruiken we de volgende commando's:<\/p>\n<pre><code class=\"bash\">a2dismod mpm_prefork  \\\/\\\/ Uitschakelen van prefork\na2dismod php7.3  \\\/\\\/ Uitschakelen van de PHP-module die afhankelijk is van prefork\na2enmod mpm_worker  \\\/\\\/ Inschakelen van worker\n<\/code><\/pre>\n<p>\nEchter, bij het gebruik van Worker kun je tegen een probleem aanlopen, omdat de module php7.3 afhankelijk is van de module Prefork.<\/p>\n<p>Om dit probleem op te lossen, installeren we de php7.3-fpm-module, die zal worden gebruikt voor het uitvoeren van php-scripts:<\/p>\n<pre><code class=\"bash\">apt-get update &amp;&amp; apt-get install php7.3-fpm  \/\/Installeren\nsystemctl enable php7.3-fpm &amp;&amp; systemctl start php7.3-fpm  \/\/Toevoegen aan opstarten en starten\na2enmod php7.3-fpm &amp;&amp; a2enconf php7.3-fpm.conf  \/\/Module en configuratie inschakelen\n<\/code><\/pre>\n<p>\nHet is de moeite waard op te merken dat het gebruik van php-fpm ook het geheugenverbruik door het apache2-proces vermindert en de uitvoering van php-scripts iets versnelt.<\/p>\n<h3>3. Conclusie<\/h3>\n<p>\nZo hebben we met deze eenvoudige acties de prestaties geoptimaliseerd en de belasting op de machine (in dit geval RPI3) verlaagd.<\/p>\n<p>Natuurlijk zijn er honderden andere optimalisatie-opties, zoals het inschakelen van compressie (wat echt nuttig is, maar meestal al standaard is ingeschakeld), het wijzigen van parameters (configuratiebestanden) van MPM, het uitschakelen van HostnameLookups, enz., maar in dit artikel heb ik geprobeerd om juist die punten weer te geven die mij het meest hebben geholpen, en ik hoop dat ze ook anderen kunnen helpen.<br \/>\n<br \/>Bron: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/444732\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 apache2 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u0430\u043b\u043e \u043a\u0442\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441\u0430\u0439\u0442\u0430, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 (\u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 php), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u0440\u043e\u0441\u0442\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0426\u041f \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0451\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u041e\u0417\u0423. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0443\u0430\u043b, \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043c\u043e\u0447\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e) \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c. \u0412\u0441\u0435 \u043d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-30053","post","type-post","status-publish","format-standard","hentry","category-blog"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 apache2 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/nl\/blog\/optimizatsiya-proizvoditelnosti-apache2\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"nl_NL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 apache2 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 apache2 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/nl\/blog\/optimizatsiya-proizvoditelnosti-apache2\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:33:26+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:33:26+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Prestaties optimaliseren van apache2 | ProHoster","description":"Velen gebruiken apache2 als webserver.","canonical_url":"https:\/\/prohoster.info\/nl\/blog\/optimizatsiya-proizvoditelnosti-apache2","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"nl_NL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 apache2 | ProHoster","og:description":"\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 apache2 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430.","og:url":"https:\/\/prohoster.info\/nl\/blog\/optimizatsiya-proizvoditelnosti-apache2","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:33:26+00:00","article:modified_time":"2019-10-31T18:33:26+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"30053","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-02-09 17:29:02","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:43:14","updated":"2026-02-09 17:29:02","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts\/30053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/comments?post=30053"}],"version-history":[{"count":1,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts\/30053\/revisions"}],"predecessor-version":[{"id":159502,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/posts\/30053\/revisions\/159502"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/media?parent=30053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/categories?post=30053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/nl\/wp-json\/wp\/v2\/tags?post=30053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}