<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Viva el Pixel &#187; Debian</title>
	<atom:link href="http://www.vivaelpixel.com/debian/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vivaelpixel.com</link>
	<description>el blog de Andy Kaiser</description>
	<lastBuildDate>Thu, 08 Dec 2011 23:12:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Optimización pageload en Apache2</title>
		<link>http://www.vivaelpixel.com/2010/01/optimizacion-pageload-en-apache2/</link>
		<comments>http://www.vivaelpixel.com/2010/01/optimizacion-pageload-en-apache2/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 19:23:49 +0000</pubDate>
		<dc:creator>Andy Kaiser</dc:creator>
				<category><![CDATA[Desarrollo web]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SEO/SEM/SMO]]></category>
		<category><![CDATA[Apache2]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[ETags]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Optimización]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Servidores]]></category>
		<category><![CDATA[Yahoo!]]></category>
		<category><![CDATA[Yslow]]></category>

		<guid isPermaLink="false">http://www.vivaelpixel.com/?p=189</guid>
		<description><![CDATA[Como optimizar los tiempos de carga de una página en Apache2, con mod_deflate, mod_headers, mod_expires y Etag para mejorar el SEO y la experiencia de los usuarios.]]></description>
			<content:encoded><![CDATA[<p>Como comentamos en <a href="http://www.vivaelpixel.com/2009/12/promocion-online-y-seo-en-el-2010/" title="Promoción online y SEO en el 2010" target="_self" class="liinternal">un post anterior</a>, en el 2010 un factor importante en los resultados del nuevo algoritmo de búsqueda de Google (Caffeine) será la velocidad de carga de una página. Por lo tanto en nuestros sitios, es imprescindible analizar y optimizar varios factores relacionados. Además al optimizar el tiempo de carga de nuestro sitio también reduciremos el ancho de banda y, dependiendo del caso, los costes del alojamiento y mejoramos la experiencia de los usuarios.</p>
<h3>Análisis</h3>
<p>Para analizar fácilmente la velocidad de carga de nuestro sitio disponemos básicamente de dos extensiones para <a href="https://addons.mozilla.org/es-ES/firefox/addon/1843" target="_blank" class="liexternal">Firefox/Firebug</a>:</p>
<ol>
<li><a href="http://developer.yahoo.com/yslow/" target="_blank" class="liexternal">Yslow</a>, creada por Yahoo!</li>
<li><a href="http://code.google.com/intl/es-ES/speed/page-speed/" target="_blank" class="liexternal">Pagespeed</a>, creada por Google</li>
</ol>
<p>Estos complementos analizan múltiples factores y nos dan sugerencias para optimizar la página analizada. Las dos extensiones son muy parecidas tanto en las pruebas que ejecutan y las sugerencias que indican, pero en Yslow destaca la integración de <a href="http://developer.yahoo.com/yslow/smushit/" target="_blank" class="liexternal">Smush.it™</a>, un optimizador de imágenes. En cambio en Pagespeed, es muy destacable la opción de disponer, en caso de sugerencia, de las alternativas <em>minified</em> u optimizadas de las css y los js, como también analizar e indicar los selectores css poco eficientes.</p>
<h3>Optimización</h3>
<p>Dependiendo de cada servidor y aplicaciones instaladas tendremos que optimizar diferentes factores, pero a modo de ejemplo, en el servidor de este blog era necesario optimizar los <em>Cache-Control Header</em> y la compresión <em>gzip</em>. Tras buscar en Google y leer varios post realice los siguientes pasos para optimizar el servidor:</p>
<h4>1. Compresión gzip con mod_deflate</h4>
<p>Primero hay que activar <em>mod_deflate</em> desde la linea de comando</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2enmod deflate</pre></div></div>

<p>Luego editar el archivo <em>deflate.conf</em> que se encuentra en <em>/etc/apache2/mods-available/deflate.conf</em></p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE text/plain
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE text/html
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE text/xml
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE text/css
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE text/javascript
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE image/svg+xml
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE image/x-icon
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/xml
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/xhtml+xml
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/rss+xml
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/javascript
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/x-javascript
&nbsp;
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/x-httpd-php
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/x-httpd-fastphp
        <span style="color: #00007f;">AddOutputFilterByType</span> DEFLATE application/x-httpd-eruby
&nbsp;
        <span style="color: #00007f;">DeflateCompressionLevel</span> <span style="color: #ff0000;">9</span>
&nbsp;
<span style="color: #adadad; font-style: italic;"># Netscape 4.X tiene ciertas limitaciones</span>
        <span style="color: #00007f;">BrowserMatch</span> ^Mozilla/<span style="color: #ff0000;">4</span> gzip-only-text/html
&nbsp;
<span style="color: #adadad; font-style: italic;"># Netscape 4.06-4.08 tiene limitaciones</span>
        <span style="color: #00007f;">BrowserMatch</span> ^Mozilla/<span style="color: #ff0000;">4</span>\.0[<span style="color: #ff0000;">678</span>] no-gzip
&nbsp;
<span style="color: #adadad; font-style: italic;"># MSIE enmascarado como Netscape</span>
        <span style="color: #00007f;">BrowserMatch</span> \bMSIE !no-gzip !gzip-only-text/html
&nbsp;
<span style="color: #adadad; font-style: italic;"># Las siguientes lineas sirven para probar que la configuración funciona, en producción hay que comentarlas</span>
 <span style="color: #00007f;">DeflateFilterNote</span> Input instream
 <span style="color: #00007f;">DeflateFilterNote</span> Output outstream
 <span style="color: #00007f;">DeflateFilterNote</span> Ratio ratio
 <span style="color: #00007f;">LogFormat</span> <span style="color: #7f007f;">'&quot;%r&quot; %{outstream}n/%{instream}n (%{ratio}n%%)'</span> deflate
 <span style="color: #00007f;">CustomLog</span> /var/log/apache2/deflate_log deflate</pre></div></div>

<h4>2. Expires headers mediante mod_expires</h4>
<p>Primero activamos el modulo</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2enmod expires</pre></div></div>

<p>Luego editamos o creamos el archivo <em>expires.conf</em> en el directorio <em>/etc/apache2/mods-available/expires.conf</em></p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">#        ExpiresDefault &quot;access plus 2 months&quot;</span>
&nbsp;
        <span style="color: #00007f;">ExpiresByType</span> image/x-icon <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> image/png <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> image/jpg <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> image/gif <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> image/jpeg <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> application/pdf <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> audio/x-wav <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> audio/mpeg <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> video/mpeg <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> video/mp4 <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> video/quicktime <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> video/x-ms-wmv <span style="color: #7f007f;">&quot;access plus 1 month&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> application/x-shockwave-flash <span style="color: #7f007f;">&quot;access 1 month&quot;</span>
&nbsp;
        <span style="color: #00007f;">ExpiresByType</span> text/css <span style="color: #7f007f;">&quot;access plus 1 hour&quot;</span>
        <span style="color: #00007f;">ExpiresByType</span> text/javascript <span style="color: #7f007f;">&quot;access plus 1 hour&quot;</span></pre></div></div>

<h4>3. Desactivar ETags</h4>
<p>Añadir las siguientes lienas al archivo <em>/etc/apache2/apache2.conf</em></p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">Header</span> unset ETag
<span style="color: #00007f;">FileETag</span> <span style="color: #0000ff;">None</span></pre></div></div>

<h4>4. Reiniciar Apache para activar los cambios</h4>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>Ya solo queda volver a comprobar la página con las extensiones de Firebug y comparar los resultados.</p>
<h4>Enlaces de interes</h4>
<ul>
<li><a href="http://code.google.com/intl/es-ES/speed/page-speed/docs/rules_intro.html" target="_blank" class="liexternal">Recomendaciones sobre rendimiento web de Google</a></li>
<li><a href="http://developer.yahoo.com/performance/rules.html" target="_blank" class="liexternal">Recomendaciones de Yahoo!</a></li>
<li><a href="http://www.realityloop.com/blog/2009/08/19/optimizing-page-load-times-using-moddeflate-modexpires-etag-apache2" target="_blank" class="liexternal">Tutorial sobre Apache2, mod_deflate, mod_expires y ETag</a></li>
<li><a href="http://www.askapache.com/htaccess/apache-speed-etags.html" target="_blank" class="liexternal">Tutorial sobre ETag</a> (Esta web tiene otros posts relacionados con optimización de Apache)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.vivaelpixel.com/2010/01/optimizacion-pageload-en-apache2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.vivaelpixel.com @ 2012-02-05 13:33:39 by W3 Total Cache -->
