{"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\/es\/blog\/optimizatsiya-proizvoditelnosti-apache2","title":{"rendered":"Optimizaci\u00f3n del rendimiento de apache2","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Muchos utilizan apache2 como servidor web. Sin embargo, pocos piensan en optimizar su rendimiento, lo que impacta directamente en la velocidad de carga de las p\u00e1ginas del sitio, la velocidad de procesamiento de scripts (en particular PHP), as\u00ed como en el aumento de la carga en la CPU y el incremento del uso de RAM. <\/p>\n<p>Por lo tanto, el siguiente manual debe ayudar a los usuarios principiantes (y no solo) a optimizarlo.<br \/>\nTodos los ejemplos a continuaci\u00f3n se utilizaron en Raspberry PI 3, Debian 9, Apache 2.4.38, PHP 7.3.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nAs\u00ed que, comencemos.<\/p>\n<h3>1. Desactivaci\u00f3n de m\u00f3dulos no utilizados<\/h3>\n<p>\nEl primer m\u00e9todo es simplemente desactivar los m\u00f3dulos que no est\u00e1s utilizando:<\/p>\n<p>Puedes ver la lista de m\u00f3dulos actualmente en uso con el comando:<\/p>\n<pre><code class=\"bash\">apache2ctl -M<\/code><\/pre>\n<p>\nPara desactivar un m\u00f3dulo, utilizamos el siguiente comando:<\/p>\n<pre><code class=\"bash\">a2dismod *nombre del m\u00f3dulo*<\/code><\/pre>\n<p>\nPor lo tanto, para activar un m\u00f3dulo, se utiliza el comando:<\/p>\n<pre><code class=\"bash\">a2enmod *nombre del m\u00f3dulo*<\/code><\/pre>\n<p>\nTen en cuenta que al utilizar <i>a2dismod<\/i>, el nombre del m\u00f3dulo debe escribirse sin la palabra m\u00f3dulo.<\/p>\n<p>Por ejemplo, si en la salida del comando <i>apache2ctl -M<\/i> ves <i>proxy_module<\/i>, entonces para desactivarlo debes usar el comando \u2014 <i>a2dismod proxy<\/i><\/p>\n<p>Los m\u00f3dulos que m\u00e1s cargan el sistema (por experiencia personal) son:<\/p>\n<ul>\n<li>PHP, Ruby, Perl y otros m\u00f3dulos para varios lenguajes de script<\/li>\n<li><a class=\"wpil_keyword_link\" href=\"https:\/\/prohoster.info\/es\/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>\nAs\u00ed que en los casos en que no necesites estos m\u00f3dulos, recomiendo desactivarlos.<\/p>\n<p>Adem\u00e1s, despu\u00e9s de desactivar cualquier m\u00f3dulo, recomiendo usar el comando \u2014 <i>apache2ctl configtest<\/i>, el cual verifica la configuraci\u00f3n de los sitios utilizados y si alguno de los m\u00f3dulos desactivados era necesario, mostrar\u00e1 un error.<\/p>\n<h3>2. Cambio de MPM (M\u00f3dulo de Procesamiento Multi) y uso de php-fpm<\/h3>\n<p>\nPor defecto, despu\u00e9s de la instalaci\u00f3n, apache2 utiliza MPM Prefork (1 hilo por conexi\u00f3n), lo que reduce notablemente el rendimiento, pero mejora la estabilidad y seguridad.<\/p>\n<p>Sin embargo, para optimizar el rendimiento, recomiendo usar MPM Worker, que permite utilizar m\u00faltiples hilos para una sola conexi\u00f3n.<\/p>\n<p>Para activarlo, utilizamos los siguientes comandos:<\/p>\n<pre><code class=\"bash\">a2dismod mpm_prefork  \\\/\\\/Desactivamos prefork\na2dismod php7.3  \\\/\\\/Desactivamos el m\u00f3dulo php que depende de prefork\na2enmod mpm_worker  \\\/\\\/Activamos worker\n<\/code><\/pre>\n<p>\nSin embargo, al utilizar Worker, puedes encontrarte con el problema de que el m\u00f3dulo php7.3 depende del m\u00f3dulo Prefork.<\/p>\n<p>Para resolver este problema, instalaremos el m\u00f3dulo php7.3-fpm, que se utilizar\u00e1 para procesar scripts php:<\/p>\n<pre><code class=\"bash\">apt-get update &amp;&amp; apt-get install php7.3-fpm  \/\/ Instalamos\nsystemctl enable php7.3-fpm &amp;&amp; systemctl start php7.3-fpm  \/\/ Agregamos al arranque autom\u00e1tico y lo iniciamos\na2enmod php7.3-fpm &amp;&amp; a2enconf php7.3-fpm.conf  \/\/ Activamos el m\u00f3dulo y su configuraci\u00f3n\n<\/code><\/pre>\n<p>\nCabe destacar que el uso de php-fpm tambi\u00e9n reducir\u00e1 el uso de RAM por parte del proceso apache2 y acelerar\u00e1 un poco el procesamiento de los scripts php.<\/p>\n<h3>3. Conclusi\u00f3n<\/h3>\n<p>\nAs\u00ed, con estas sencillas acciones, logramos optimizar el rendimiento y reducir la carga en la m\u00e1quina (en este caso RPI3).<\/p>\n<p>Por supuesto, hay cientos de otras opciones de optimizaci\u00f3n, como habilitar la compresi\u00f3n (que realmente es \u00fatil, pero en su mayor\u00eda ya est\u00e1 habilitada por defecto), cambiar par\u00e1metros (archivos de configuraci\u00f3n) de MPM, desactivar HostnameLookups, etc., pero en este art\u00edculo intent\u00e9 reflejar precisamente aquellos puntos que m\u00e1s me ayudaron y espero que tambi\u00e9n ayuden a otros.<br \/>\n<br \/>Fuente: <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.2 - 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\/es\/blog\/optimizatsiya-proizvoditelnosti-apache2\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"es_ES\" \/>\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\/es\/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\udd47Optimizaci\u00f3n del rendimiento de apache2 | ProHoster","description":"Muchos utilizan apache2 como servidor web.","canonical_url":"https:\/\/prohoster.info\/es\/blog\/optimizatsiya-proizvoditelnosti-apache2","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"es_ES","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\/es\/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\/es\/wp-json\/wp\/v2\/posts\/30053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/comments?post=30053"}],"version-history":[{"count":1,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/posts\/30053\/revisions"}],"predecessor-version":[{"id":159502,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/posts\/30053\/revisions\/159502"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/media?parent=30053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/categories?post=30053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/es\/wp-json\/wp\/v2\/tags?post=30053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}