<?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>JomPeich d&#039;er Bisente &#187; lighttpd</title> <atom:link href="http://www.bisente.com/blog/category/linuxadas/lighttpd/feed/" rel="self" type="application/rss+xml" /><link>http://www.bisente.com</link> <description>Este es mi blog. Hay otros muchos pero este es el mío.</description> <lastBuildDate>Mon, 23 Jan 2012 06:37:00 +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>Depurando problemas con nginx</title><link>http://www.bisente.com/blog/2010/03/04/depurando-problemas-con-nginx/</link> <comments>http://www.bisente.com/blog/2010/03/04/depurando-problemas-con-nginx/#comments</comments> <pubDate>Thu, 04 Mar 2010 06:51:04 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[daemontools]]></category> <category><![CDATA[English]]></category> <category><![CDATA[lighttpd]]></category> <category><![CDATA[Linuxadas]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[análisis]]></category> <category><![CDATA[CLOSE_WAIT]]></category> <category><![CDATA[conexión]]></category> <category><![CDATA[connection]]></category> <category><![CDATA[debug]]></category> <category><![CDATA[depurar]]></category> <category><![CDATA[netstat]]></category> <category><![CDATA[nginx]]></category> <category><![CDATA[problemas]]></category> <category><![CDATA[problems]]></category> <category><![CDATA[script]]></category> <category><![CDATA[servidor]]></category><guid isPermaLink="false">http://www.bisente.com/?p=1360</guid> <description><![CDATA[Last week I&#8217;ve been debugging a problem I had with this site&#8217;s nginx server: from time to time it hanged and I had to restart the process. Some time ago I wrote a little script that checked if it was running &#8230; <a href="http://www.bisente.com/blog/2010/03/04/depurando-problemas-con-nginx/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>Last week I&#8217;ve been debugging a problem I had with this site&#8217;s <a title="nginx" href="http://wiki.nginx.org">nginx</a> server: from time to time it hanged and I had to restart the process. Some time ago I wrote a little script that checked if it was running OK and restarted it otherwise, but anyway that wasn&#8217;t a real solution.</p><p>So I spent some days really looking into it and asking for support and reporting my findings to the <a title="nginx mailing list" href="http://nginx.org/pipermail/nginx/">nginx mailing list</a>. One useful tip I got there was enabling the &#8220;debug&#8221; mode on the <a title="nginx error_log" href="http://wiki.nginx.org/NginxHttpMainModule#error_log">error log</a>, which shows full traces of the processes (including their PID) as they&#8217;re processing the request, the rewrites, upstreams, etc.</p><div class="codesnip-container" >error_log /var/log/nginx/$host-error.log debug;</div><p>With this extended log and the PID of the process malfunctioning, it&#8217;s quite easy finding out what that process was doing right before hanging. In order to find out the PID of the hanged processes, I extended my check-reboot script to log some generic system metrics right before restarting nginx: netstat -nap (which shows the PID), ps, vmstat, etc.</p><div class="codesnip-container" ><pre>#!/bin/sh

TIMEOUT=20
CHECK=http://localhost/wp-admin/
LOG=/var/log/checkWeb/checkWeb-$(date +%Y%m%d).log
LOGR=/var/log/checkWeb/restart-$(date +%Y%m%d).log
TMP=/tmp/checkWeb-$RANDOM

if ! wget -t 1 -o /dev/null -O /dev/nul -T $TIMEOUT $CHECK
then
echo "ERROR, restarting nginx"
echo "** RESTARTING **" &gt;&gt; $TMP
date &gt;&gt; $TMP
echo "- CLOSE_WAIT:" &gt;&gt; $TMP
netstat -nap | grep -c CLOSE_WAIT &gt;&gt; $TMP
echo "- vmstat" &gt;&gt; $TMP
vmstat 1 5 &gt;&gt; $TMP
echo "- free" &gt;&gt; $TMP
free &gt;&gt; $TMP
echo "- ps" &gt;&gt; $TMP
ps aux &gt;&gt; $TMP
echo "- netstat" &gt;&gt; $TMP
netstat -nap &gt;&gt; $TMP
echo "" &gt;&gt; $TMP
echo "" &gt;&gt; $TMP

#       pkill -9 -f php-cgi
pkill -9 -f nginx
sleep 1s
/etc/init.d/nginx start

cat $TMP
cat $TMP &gt;&gt; $LOG
date &gt;&gt; $LOGR
fi

rm -rf $TMP</pre></div><p>This way, each time localhost/wp-admin was unresponsive (I was debugging a WP site), besides restarting nginx I was getting a lot of system info. With time I got to realize that nginx processes were not actually hanging, but some of their sockets got on the CLOSE_WAIT state forever until the process was restarted. Looking for the PID of those processes according to netstat on the error log, the last request they were processing before getting to the CLOSE_WAIT state was always the same: on my blog I have some examples of how running servers with <a title="daemontools" href="http://www.bisente.com/blog/category/linuxadas/daemontools/">daemontools</a>; daemontools uses named pipes (FIFOs), which can become kind of black holes if there&#8217;s no process feeding them; when nginx hit one of these FIFOs, it hanged.</p><p>Funny thing is that I never had this problem with either Apache nor lighttpd. But anyway the problem is not nginx but those FIFOs which shouldn&#8217;t really be there. I removed them and have had no hanged processes in five days, while before this nginx was restarting 3-4 times a day.</p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2010/03/04/depurando-problemas-con-nginx/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Probando nginx</title><link>http://www.bisente.com/blog/2009/09/03/probando-nginx/</link> <comments>http://www.bisente.com/blog/2009/09/03/probando-nginx/#comments</comments> <pubDate>Thu, 03 Sep 2009 16:52:18 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Internet]]></category> <category><![CDATA[lighttpd]]></category> <category><![CDATA[Linuxadas]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[lighty]]></category> <category><![CDATA[nginx]]></category> <category><![CDATA[servidor]]></category> <category><![CDATA[VPS]]></category> <category><![CDATA[web]]></category><guid isPermaLink="false">http://www.bisente.com/?p=1243</guid> <description><![CDATA[Estoy cacharreando con nginx. El nuevo servidor virtual donde tengo el dominio está un poco justo, con la migración lo dejé con Apache en vez de volver a lighttpd y ahora estoy probando alternativas. Como aparte de configurar el servidor &#8230; <a href="http://www.bisente.com/blog/2009/09/03/probando-nginx/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Estoy cacharreando con <a title="nginx" href="http://nginx.net/">nginx</a>. El nuevo servidor virtual donde tengo el dominio está un poco justo, con la migración lo dejé con Apache en vez de volver a <a title="lighttpd" href="http://www.bisente.com/blog/category/linuxadas/lighttpd/">lighttpd</a> y ahora estoy probando alternativas.</p><p>Como aparte de configurar el servidor y el PHP con fast-cgi hay que convertir todos los rewrites del Apache (wpmu y super-cache) al formato de nginx, es posible que el blog haga cosas raras, no se actualice debidamente, algunas páginas no vayan bien, pete, no acepte comentarios, o cobre consciencia de sí mismo y decida matar a todos los humanos. YMMV.</p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2009/09/03/probando-nginx/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>cut &#124; sort &#124; uniq: Apache logs</title><link>http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/</link> <comments>http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/#comments</comments> <pubDate>Wed, 26 Mar 2008 20:24:16 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Command Line]]></category> <category><![CDATA[English]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Internet]]></category> <category><![CDATA[lighttpd]]></category> <category><![CDATA[Linuxadas]]></category> <category><![CDATA[access.log]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[bots]]></category> <category><![CDATA[DoS]]></category> <category><![CDATA[grep]]></category> <category><![CDATA[logs]]></category> <category><![CDATA[sort]]></category> <category><![CDATA[uniq]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/</guid> <description><![CDATA[Many times the reason because a web server is slow and unresponsive is that it&#8217;s under &#8220;attack&#8221;, on purpose or not, by a bot. I&#8217;ve seen cases where Google Bot, bots from research engines from universities or some other kind &#8230; <a href="http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>Many times the reason because a web server is slow and unresponsive is that it&#8217;s under &#8220;attack&#8221;, on purpose or not, by a bot. I&#8217;ve seen cases where Google Bot, bots from research engines from universities or some other kind of indexer were responsible for more than half the traffic of a site. These cases are not real <a href="http://en.wikipedia.org/wiki/Denial-of-service_attack" title="DoS">DoS attacks</a>, this traffic can be considered legitimate, but the result is that it brings the service down. You can instruct some of these bots not to visit your site so often, like Google Bot using the <a href="http://www.google.com/webmasters/tools/" title="Google Webmaster Tools">Google Webmaster Tools</a> and the <a href="http://www.sitemaps.org/" title="sitemaps">sitemaps</a> and/or <a href="http://www.robotstxt.org/" title="robots.txt">robots.txt</a> files, but usually you can&#8217;t and have to consider filtering all this traffic at the firewall. But in any case, the first step is realizing that a single IP (or a couple of them) is responsible for most of your traffic, identifying this IP and using <a href="http://en.wikipedia.org/wiki/Whois" title="whois">whois</a> learn who it belongs to.</p><p>You can run something like this to list the top five IP addresses on your Apache&#8217;s access.log:</p><pre>
<div class="codesnip-container" >cut -d" " -f 1 access.log | sort | uniq -c | sort -nr | head -n 5</div>
</pre>]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2008/03/26/cut-sort-uniq-apache-logs/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Scripts daemontools para lighttpd y PHP</title><link>http://www.bisente.com/blog/2007/09/24/daemontools-lighttpd-php/</link> <comments>http://www.bisente.com/blog/2007/09/24/daemontools-lighttpd-php/#comments</comments> <pubDate>Mon, 24 Sep 2007 15:18:48 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[daemontools]]></category> <category><![CDATA[English]]></category> <category><![CDATA[lighttpd]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/09/24/daemontools-lighttpd-php/</guid> <description><![CDATA[I&#8217;ve prepared a set of daemontools scripts to launch and monitor lighttpd and its PHP processes spawned with spawn-fcgi. Here is the README, a tar file with the scripts, and here you can browse the directories with all the scripts. &#8230; <a href="http://www.bisente.com/blog/2007/09/24/daemontools-lighttpd-php/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>I&#8217;ve prepared a set of <a href="http://cr.yp.to/daemontools.html" title="DJB's daemontools">daemontools</a> scripts to launch and monitor <a href="http://www.lighttpd.net/" title="lighttpd">lighttpd</a> and its <a href="http://www.php.net/" title="PHP">PHP</a> processes spawned with <a href="http://www.bisente.com/blog/2007/09/21/php-con-lighttpd-150/" title="PHP with lighttpd 1.5.x">spawn-fcgi</a>. Here is the <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/daemontools/lighttpd-daemontools/lighttpd-daemontools-latest/README.txt" title="lighttpd daemontools README">README</a>, a <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/daemontools/lighttpd-daemontools/lighttpd-daemontools-latest.tar.bz2" title="lighttpd and PHP daemontools scripts">tar file with the scripts</a>, and here you can <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/programas/daemontools/lighttpd-daemontools/lighttpd-daemontools-latest/" title="lighttpd and PHP daemontools scripts">browse the directories with all the scripts</a>.</p><p>PS: yes, <a href="http://www.bisente.com/blog/category/linuxadas/daemontools/" title="I like daemontools">I like daemontools</a>. It helps me achieving high availability with many services, keeping them up even when a server misbehaves and some process dies. This avoids a lot of late night calls. It&#8217;s a great invention. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/09/24/daemontools-lighttpd-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PHP con lighttpd 1.5.0</title><link>http://www.bisente.com/blog/2007/09/21/php-con-lighttpd-150/</link> <comments>http://www.bisente.com/blog/2007/09/21/php-con-lighttpd-150/#comments</comments> <pubDate>Fri, 21 Sep 2007 07:07:17 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[lighttpd]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/09/21/php-con-lighttpd-150/</guid> <description><![CDATA[PHP integration and configuration in lighttpd 1.5.0 has changed: mod_fastcgi isn&#8217;t used any more, you need mod_proxy_backend_fastcgi instead; and lighty won&#8217;t launch the PHP processes, you&#8217;ll have to start them using the spawn-fcgi program. In order to setup mod_proxycore for &#8230; <a href="http://www.bisente.com/blog/2007/09/21/php-con-lighttpd-150/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>PHP integration and configuration in <a href="http://blog.lighttpd.net/articles/2007/09/06/pre-release-lighttpd-1-5-0-r1992" title="lighttpd 1.5.0">lighttpd 1.5.0</a> has changed: mod_fastcgi isn&#8217;t used any more, you need <a href="http://trac.lighttpd.net/trac/wiki/Docs%3AModProxyCore" title="mod_proxy_core">mod_proxy_backend_fastcgi</a> instead; and lighty won&#8217;t launch the PHP processes, you&#8217;ll have to start them using the <a href="http://trac.lighttpd.net/trac/wiki/FrequentlyAskedQuestions#Whereisthespawn-phpprogramscriptavailablefromitsmentionedindocsbutnotavailableinthedistributedpackage1.3.7" title="spawn-fcgi">spawn-fcgi</a> program.</p><p>In order to setup mod_proxycore for use with PHP, this is the bare minimum configuration (put it in lighttpd.conf, or conf-enabled/php.conf):</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;">server.modules += <span class="br0">&#40;</span> <span class="st0">&quot;mod_proxy_core&quot;</span>, <span class="st0">&quot;mod_proxy_backend_fastcgi&quot;</span> <span class="br0">&#41;</span></p><p><span class="re1">$PHYSICAL</span><span class="br0">&#91;</span><span class="st0">&quot;existing-path&quot;</span><span class="br0">&#93;</span> =~ <span class="st0">&quot;.php$&quot;</span> <span class="br0">&#123;</span><br /> proxy-core.allow-x-sendfile = <span class="st0">&quot;enable&quot;</span><br /> proxy-core.protocol = <span class="st0">&quot;fastcgi&quot;</span><br /> proxy-core.backends = <span class="br0">&#40;</span> <span class="st0">&quot;unix:/tmp/php-fastcgi.sock&quot;</span> <span class="br0">&#41;</span><br /> proxy-core.max-pool-size = <span class="nu0">16</span><br /> <span class="br0">&#125;</span></div></div><p>And for the PHP fast-cgi processes, just run or prepare an init.d script that runs the following command:</p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;"><span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>spawn-fcgi <span class="re5">-s</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>php-fastcgi.sock <span class="re5">-f</span> <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>php-cgi <span class="re5">-u</span> www-data <span class="re5">-g</span> www-data <span class="re5">-C</span> 5 <span class="re5">-P</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>spawn-fcgi.pid</div></div> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/09/21/php-con-lighttpd-150/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>lighttpd 1.5.0-SVN r1992 para Debian Sarge</title><link>http://www.bisente.com/blog/2007/09/20/lighttpd-150-svn-r1992-debian-sarge/</link> <comments>http://www.bisente.com/blog/2007/09/20/lighttpd-150-svn-r1992-debian-sarge/#comments</comments> <pubDate>Thu, 20 Sep 2007 19:32:56 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[lighttpd]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/09/20/lighttpd-150-svn-r1992-debian-sarge/</guid> <description><![CDATA[I&#8217;ve built .deb packages of lighttpd 1.5.0-SVN r1992 for Debian Sarge. They&#8217;re based off the latest packages in testing, upgraded to 1.5.0. The only thing missing is mod_mysql_vhost, as I don&#8217;t have mySQL 5.0 installed at the moment. This server &#8230; <a href="http://www.bisente.com/blog/2007/09/20/lighttpd-150-svn-r1992-debian-sarge/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>I&#8217;ve built .deb packages of <a href="http://blog.lighttpd.net/articles/2007/09/06/pre-release-lighttpd-1-5-0-r1992" title="lighttpd 1.5.0-SVN r1992">lighttpd 1.5.0-SVN r1992</a> for Debian Sarge. They&#8217;re based off the latest packages in testing, upgraded to 1.5.0. The only thing missing is mod_mysql_vhost, as I don&#8217;t have mySQL 5.0 installed at the moment. This server already runs lighty 1.5.0, so the fact that you&#8217;re reading this page is the best proof that it works. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p><p>The packages are available for download <a href="http://www.bisente.com/wp-content/blogs.dir/bisente/packages/lighttpd/1.5.0-r1992/" title="lighttpd 1.5.0-SVN r1992 Debian Sarge">here</a>.</p><p>(PS: I know, I know, what I should do is upgrade to Etch altogether&#8230;)</p><p><strong>UPDATE (20070921)</strong>: new release with <a href="http://blog.lighttpd.net/articles/2006/11/12/lighty-1-5-0-and-linux-aio" title="lighttpd linux-aio-sendfile">linux-aio-sendfile</a> support. You&#8217;ll need the libaio port too.</p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/09/20/lighttpd-150-svn-r1992-debian-sarge/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>CakePHP y lighttpd</title><link>http://www.bisente.com/blog/2007/09/07/cakephp-y-lighttpd/</link> <comments>http://www.bisente.com/blog/2007/09/07/cakephp-y-lighttpd/#comments</comments> <pubDate>Fri, 07 Sep 2007 09:02:28 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[CakePHP]]></category> <category><![CDATA[English]]></category> <category><![CDATA[Internet]]></category> <category><![CDATA[lighttpd]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/09/07/cakephp-y-lighttpd/</guid> <description><![CDATA[I&#8217;ve been busy the last couple of days with a web project I&#8217;m developing using CakePHP, and I wanted to use lighttpd as the web server. CakePHP comes with the typical .htaccess with Apache&#8217;s mod_rewrite rules, that need to be &#8230; <a href="http://www.bisente.com/blog/2007/09/07/cakephp-y-lighttpd/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>I&#8217;ve been busy the last couple of days with a web project I&#8217;m developing using <a href="http://www.cakephp.org/" title="CakePHP">CakePHP</a>, and I wanted to use <a href="http://www.lighttpd.net/" title="lighttpd">lighttpd</a> as the web server. CakePHP comes with the typical .htaccess with Apache&#8217;s mod_rewrite rules, that need to be converted to lighty&#8217;s format. The solution can be found here, 3rd comment:</p><p><a href="http://bakery.cakephp.org/articles/view/lighttpd-and-cakephp-setup-in-subdirectories" title="CakePHP and lighttpd">Lighttpd and CakePHP setup in subdirectories</a></p><div class="codesnip-container" ><div class="bash codesnip" style="font-family:monospace;">url.rewrite-once = <span class="br0">&#40;</span><br /> <span class="st0">&quot;/(.*)\.(.*)&quot;</span> =<span class="sy0">&amp;</span>gt; <span class="st0">&quot;$0&quot;</span>,<br /> <span class="st0">&quot;/(css|files|img|js)/&quot;</span> =<span class="sy0">&amp;</span>gt; <span class="st0">&quot;$0&quot;</span>,<br /> <span class="st0">&quot;^/([^.]+)$&quot;</span> =<span class="sy0">&amp;</span>gt; <span class="st0">&quot;/index.php?url=$1&quot;</span><br /> <span class="br0">&#41;</span></div></div> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/09/07/cakephp-y-lighttpd/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Arquitecturas escalables en Google</title><link>http://www.bisente.com/blog/2007/08/26/arquitecturas-escalables-en-google/</link> <comments>http://www.bisente.com/blog/2007/08/26/arquitecturas-escalables-en-google/#comments</comments> <pubDate>Sun, 26 Aug 2007 15:56:21 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Internet]]></category> <category><![CDATA[lighttpd]]></category> <category><![CDATA[Linuxadas]]></category> <category><![CDATA[Tecnología]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/08/26/arquitecturas-escalables-en-google/</guid> <description><![CDATA[A coworker has sent me three interesting articles from High Scalability, a site I still didn&#8217;t knew but which I&#8217;ve already added to my Google Reader list. The articles talk about the design and computer/network architecture decisions taken at YouTube, &#8230; <a href="http://www.bisente.com/blog/2007/08/26/arquitecturas-escalables-en-google/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>A coworker has sent me three interesting articles from <a href="http://highscalability.com/" title="High Scalability">High Scalability</a>, a site I still didn&#8217;t knew but which I&#8217;ve already added to my Google Reader list. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> The articles talk about the design and computer/network architecture decisions taken at YouTube, Google and GTalk in order to handle the big load their services face. They also comment the current architecture in each site and their evolution over time:</p><ul><li><a href="http://highscalability.com/youtube-architecture" title="YouTube Architecture">YouTube Architecture</a></li><li><a href="http://highscalability.com/google-architecture" title="Google Architecture">Google Architecture</a></li><li><a href="http://highscalability.com/googletalk-architecture" title="GoogleTalk Architecture">GoogleTalk Architecture</a></li></ul><p>Some lessons to learn from these articles:</p><ul><li>Don&#8217;t try to fix everything with one single architecture or tool. Divide the problem, see if each sub-problem is CPU-, bandwidth- or IO-bound, and optimize it. Specialize server for each task and coordinate their work.</li><li>Cache content whenever possible. Pre-generate content whenever possible. Make good use of <a href="http://www.bisente.com/blog/2007/06/21/cabalgando-los-gusanos/#more-103" title="Cabalgando los gusanos">HTTP&#8217;s cache-control directives</a>. Use <a href="http://www.bisente.com/blog/2007/08/09/un-akamai-de-andar-por-casa/" title="Un Akamai de andar por casa">squid as a reverse proxy</a> to leverage your application servers&#8217; load.</li><li>Think about externalizing some things, like hosting images or videos off-site. These elements may need more bandwidth that you currently have, and  moving them off-site can be a good idea, even if it&#8217;s just a temporary measure while you manage to get more bandwidth. The service must run at all times.</li><li>Simplicity. Will let you make changes and evolve your architecture without screwing up.</li><li>Commodity-PC based clusters. They maximize the power/price ratio. Have a redundancy system in place so that when one node goes down or needs maintainence, the system keeps working without it. Have a system to easily install/change a node, also without affecting the service. And start planning the power and cooling problems ahead. <img src='http://www.bisente.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></li><li>Programming today is much about libraries and frameworks. Don&#8217;t reinvent the wheel. Use a common framework in all your developments, homegrown or not. This way novel programmers will be able to start writting code faster, will be able to switch projects easily, won&#8217;t have to code the same things over and over again, and a system upgrade will benefit all your applications.</li><li>Think about the architecture you&#8217;ll need from the start. I&#8217;m sadly used to developers not caring about what their code runs on, or if their code will lead to CPU, IO or bandwidth problems. Google seems to face every new development looking at the architecture they&#8217;ll need to handle the service, and then develop the code arount that architecture. This is what settles Google appart from the rest.</li></ul> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/08/26/arquitecturas-escalables-en-google/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Cabalgando los gusanos</title><link>http://www.bisente.com/blog/2007/06/21/cabalgando-los-gusanos/</link> <comments>http://www.bisente.com/blog/2007/06/21/cabalgando-los-gusanos/#comments</comments> <pubDate>Thu, 21 Jun 2007 19:28:09 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[Blogs]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Internet]]></category> <category><![CDATA[lighttpd]]></category> <category><![CDATA[Linuxadas]]></category> <category><![CDATA[SPAM]]></category> <category><![CDATA[Tecnología]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/06/21/cabalgando-los-gusanos/</guid> <description><![CDATA[&#8220;Debes cabalgar por la arena a la luz del día, para que Shai-hulud vea y sepa que no tienes miedo.&#8221; &#8211; Dune, de Frank Herbert &#8220;Si no está en Google, no existe&#8221;. Esta frase tan categórica es cierta tanto para &#8230; <a href="http://www.bisente.com/blog/2007/06/21/cabalgando-los-gusanos/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p align="right">&#8220;Debes cabalgar por la arena a la luz del día,<br /> para que Shai-hulud vea y sepa que no tienes miedo.&#8221;</p><p align="right">&#8211; <em><a href="http://es.wikipedia.org/wiki/Dune" title="Dune">Dune</a></em>, de Frank Herbert</p><p>&#8220;Si no está en Google, no existe&#8221;. Esta frase tan categórica es cierta tanto para comercios on-line o webs corporativas, como para nuestro blog personal. Cuando necesitamos localizar información en Internet, vamos a Google. Y quien dice Google, dice Yahoo, MSN, o cualquier otro buscador. <em>Tenemos</em> que estar ahí.</p><p>Éstos buscadores usan &#8220;<em>bots</em>&#8221; o <em>&#8220;spiders&#8221;</em> para indexar el contenido de nuestras páginas, programas que periódicamente recorren todos los sitios que ya conocen en busca de actualizaciones y nuevos enlaces a través de los cuales descubrir, procesar e indexar más y más páginas</p><p>A nadie se le escapa que el trabajo de éstos programas es beneficioso, pero normalmente no tenemos en cuenta que generan tráfico extra a nuestra web. Aunque parezca mentira, conozco sitios en los que el tráfico de GoogleBot y compañía (ojo, hablo del propio bot, no de visitas dirigidas desde el buscador) consumía hasta un tercio del ancho de banda total de los accesos. Estamos hablando de <em>GIGAS</em> de tráfico al día.</p><p>Además los buscadores penalizan la información repetida: si tenemos varias páginas con contenido igual o muy similar, o aún peor, si podemos cargar una misma página con varias URLs distintas, podemos llevarnos sorpresas desagradables como páginas que no aparecen en los resultados de una búsqueda en favor de un feed o un resumen (índice de sección, categoría, etc.) con contenido similar, o páginas con un pagerank bajo porque éste se &#8220;diluye&#8221; entre varias URLs.</p><p>Por ello es importante aprender cómo funcionan éstos bots para saber cómo optimizar su paso por nuestro sitio web, cómo &#8220;llevarlos de la mano&#8221; hasta la información que queremos priorizar para así mejorar nuestro posicionamiento en los resultados, minimizando a su vez cuando sea posible la cantidad de información transmitida para no saturar nuestra conexión y servidores.<br /> <span id="more-103"></span></p><h2>HTTP</h2><p>GoogleBot, Yahoo! Slurp, etc. se comunican con nuestro servidor web mediante el protocolo HTTP, igual que haría cualquier otro cliente. Y son clientes &#8220;educados&#8221; que cumplen el protocolo.</p><p></p><p>Mucha gente desconoce que el protocolo HTTP 1.1 tiene métodos para controlar desde el servidor el funcionamiento de la gestión del contenido por parte de las cachés clientes (en proxies, navegadores, etc.) con una serie de cabeceras que indican la fecha de modificación del contenido, si ha sido modificado desde el último acceso, y una fecha de validez (o caducidad, como queramos verlo) hasta la cual indicamos que no es necesario volver a acceder a la página a refrescar el contenido.</p><p>Usando éstas cabeceras HTTP (Cache-Control, Last-Modified, Etag y Expires, junto con el código de respuesta 304) podemos ajustar cada cuánto tiempo cada cliente, sea Google, Yahoo, un proxie o la caché de nuestro navegador, va a venir al servidor a refrescar el contenido, y una vez que venga, devolverle la página completa si ésta ha sido actualizada o ahorrarnos el tráfico informándole de que la versión que tiene en caché aún es válida, renovando a su vez su periodo de validez. Es una forma de reducir drásticamente el tráfico de nuestros servidores y mejorar los tiempos de respuesta de cara al cliente, visitantes normales con un navegador también. Eso sí, siempre que tengamos muy clara la &#8220;caducidad&#8221; de cada una de las páginas según su contenido, ya que si nos pasamos podemos provocar que no se &#8220;vean&#8221; las actualizaciones.</p><p>Por ejemplo, para un sitio web con contenido actualizado a diario, podríamos configurar: para la portada una validez de cinco minutos; para cada artículo del día, quince, por si se actualizan para corregir cualquier error o puntualizar algún detalle; para el contenido de entre uno y diez días de antigüedad, doce horas o un día; y para lo que tenga más de diez días&#8230; un año, o más si asumimos que el contenido tan viejo no se va a actualizar nunca.</p><p>¿Cómo hacer uso de éstas cabeceras? La mayoría de servidores web (Apache, lighttpd&#8230;) usan la fecha de modificación de ficheros estáticos de forma automática para generar éstas cabeceras. Para el contenido dinámico, o forzamos unos datos según URLs en la configuración del servidor web, o bien generamos éstas cabeceras en programación.</p><p>Aparte de todo el control de caché, hemos comentado que no es conveniente que varias URLs apunten a un mismo contenido para que éste sea único y esté unívocamente identificado por su dirección. Si por ejemplo tenemos varios dominios (.com, .es y .net), o hemos refactorizado recientemente la programación y hemos tenido que reestructurar las URL, lo que lo que deberíamos hacer es redirigir todos los accesos a una URL única (dominio principal y estructura de directorios &#8220;canónica&#8221;) mediante una respuesta HTTP 301, de forma que centralicemos todo el contenido en un único dominio, y que cada página tenga una única ruta.</p><ul><li><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html">Sección de la especificación HTTP 1.1 sobre control de caché</a></li><li><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">Sección de la especificación HTTP 1.1 sobre códigos de respuesta</a></li><li><a href="http://www.mnot.net/cache_docs/" title="Doc sobre cache-control">Excelente tutorial sobre control de caché</a></li></ul><h2></h2><h2>robots.txt</h2><p>En el fichero <em>robots.txt</em> podemos definir una serie de reglas para denegar el acceso a ciertas URLs según el <em>User-Agent</em> del bot que esté consultando la página. Es un protocolo establecido hace muchos años, y de nuevo GoogleBot y sucedáneos lo cumplen al pié de la letra. Y como su nombre indica, es un protocolo exclusivo para bots: un navegador normal no lee éste fichero ni se rige por las reglas que aquí definamos.</p><p>¿Utilidades? Varias: denegar el acceso a determinados bots a ciertas partes &#8220;privadas&#8221;, o que por cualquier motivo no queramos que se indexen, de nuestra web; bloquear completamente el acceso a ciertos bots que no nos interesen (porque es un buscador en el que no queremos aparecer, porque nos consulta demasiado rápido y nos satura&#8230;); bloquear el acceso a los feeds RSS para evitar que se indexen, ya que duplican contenido y pueden llegar a tener precedencia en los resultandos sobre las páginas &#8220;reales&#8221;; etc.</p><p>Sin embargo, este fichero es algo que hay que usar con cuidado: hay que tener muy claro que no le estamos diciendo a un bot que no indexe una página, si no que NO ENTRE en ella. Y si no entra, no descubrirá (ni seguirá e indexará) los enlaces que puedan &#8220;colgar&#8221; de ella. Así que si no somos cuidadosos podemos acabar bloqueando el acceso a partes completas de nuestra web que si que nos interesaría que se indexaran.</p><p>Como mínimo, si tenemos una estructura de carpetas/URLs decentemente organizada, si que podemos filtrar sin peligro feeds, carpetas con estilos CSS, carpetas con ficheros Javascript, carpetas con imágenes (si no queremos aparecer en Google Images), etc.</p><ul><li><a href="http://www.robotstxt.org/wc/robots.html" title="robots.txt">Página sobre el fichero robots.txt</a></li><li><a href="http://www.utheguru.com/seo_wordpress-wordpress-seo-plugin" title="seo wordpres">Plugin SEO para WordPress, much ainformación sobre robots y METAs</a></li></ul><h2></h2><h2>METAs y rel=&#8221;nofollow&#8221;</h2><p>Durante muchos años el protocolo para facilitarle la vida a los bots informándoles nosotros del contenido (content) y carácter (keywords) de nuestras páginas fue mediante tags META en el encabezado (&lt;head&gt;) de las páginas. Sin embargo con el paso del tiempo se vio que al depender sólo del buen hacer (o mejor dicho, de la buena fe) del webmaster eran fáciles de falsear, con lo que hoy en día prácticamente ningún buscador les presta mayor atención y se fijan principalmente en el contenido real en el cuerpo (&lt;body&gt;) del fichero HTML. Sin embargo si que hay un META que nos va a ser útil para marcar el camino a los bots: el meta &#8220;robots&#8221;.</p><p></p><p>Éste META puede contener dos valores de los dos pares (no)index y (no)follow: index/noindex indica al bot que considere (o no) el contenido de la página actual para su indexación, mientras que follow/nofollow le indica que siga o no todos los enlaces que encuentre en la página. Con el primero controlamos si no queremos que el bot se fije en el contenido de la página actual, mientras que con el segundo indicamos si queremos que continúe rastreando a partir de la página actual o que vuelva a la página anterior. Los valores por defecto si no indicamos lo contrario serían &#8220;index, follow&#8221;: indexar la página actual y seguir todos los enlaces.</p><p>Utilidad: evitar contenido repetido evitando la indexación de páginas de resumen, portadas, categorías, etc. en favor de las páginas con los artículos completos. Esto lo haríamos con:</p><div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;">meta name=&quot;robots&quot; content=&quot;noindex,follow&quot;</div></div><p>&#8220;nofollow&#8221; nos sería útil para evitar el acceso de los bots a ciertas partes de nuestra web (como haríamos con el robots.txt) o para &#8220;ocultarle&#8221; de alguna forma enlaces a webs externas para que no tenga éstas relaciones en cuenta de cara a calcular el PageRank (en el caso de Google).</p><p>follow/nofollow en el meta se aplica de forma global a todos los enlaces de la página. Si sólo queremos controlar que no se sigan ciertos enlaces externos, podemos usar rel=&#8221;nofollow&#8221; en cada enlace de forma individual:</p><div class="codesnip-container" ><div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;http://www.example.com&quot;</span> <span class="kw3">rel</span><span class="sy0">=</span><span class="st0">&quot;nofollow&quot;</span>&gt;</span>Ejemplo<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;</span></div></div><p>Ésto es útil para evitar enlazar páginas de SPAM, p.ej. añadiendo de forma automática éste atributo a todos los enlaces que se puedan introducir en nuestra página por parte del usuario (comentarios, foros&#8230;)</p><ul><li><a href="http://www.robotstxt.org/wc/meta-user.html" title="META">Información sobre el META ROBOTS</a></li><li><a href="http://www.seoconsultants.com/html/links/nofollow.asp" title="METAS">Más información sobre los METAs</a></li></ul><h2></h2><h2>Google Sitemaps</h2><p>Por último, vamos a ver el método de más reciente aparición de todos: el fichero <em>sitemap.xml</em>.</p><p>Sitemaps es un protocolo originario de Google para ayudar a su bot a conocer mejor la organización y periodicidad de actualización del contenido de nuestra página, aunque Yahoo y MSN lo han adoptado ya también por lo que podemos considerar que es un estándar &#8220;de facto&#8221;. Se trata de un fichero XML con una sintaxis bastante sencilla en el que indicamos todas y cada una de las URL de nuestro sitio, su fecha de creación, modificación, una estimación de con qué periodicidad se puede actualizar (o cuánta validez le damos a la información, cada cuánto tiempo tendría que volver el bot a indexarla), y un &#8220;peso&#8221; con el que indicaríamos la relevancia relativa de cada página con respecto al resto.</p><p>En líneas generales puede parecer que todos éstos datos ya se los estábamos dando con los métodos anteriores: las cabeceras HTTP para indicar la validez, el robots.txt y el follow/nofollow para controlar dónde entra&#8230; la diferencia fundamental radica en que sin el sitemap, el bot de turno accede a nuestra página y va siguiendo enlaces, descubriendo como medianamente puede cada una de los distintos archivos que forman nuestro sitio; mientras que con el sitemap, nosotros le damos una lista de todas y cada una de las URLs que queremos que indexe, además de la importancia relativa que le damos a cada página.</p><ul><li><a href="http://www.sitemaps.org/" title="sitemaps">Información sobre sitemaps</a></li></ul><h2></h2><h2>Resumen</h2><p>Hemos visto varias técnicas para guiar a los bots de los buscadores en su paso por nuestra web, indicándoles dónde entrar y dónde no, qué indexar y qué no, con qué periodicidad volver y si ha habido actualizaciones en nuestra página. Nos hemos centrado en los métodos para minimizar el tráfico extra que nos van a generar las visitas de éstos bots, pero maximizando su productividad.</p><p>Ésto es sólo una pequeña parte de todo lo que deberemos tener en cuenta a la hora de diseñar nuestra web y su contenido de cara a conseguir un buen posicionamiento. En internet hay infinidad de artículos sobre SEO orientados a cómo construir y organizar la maquetación HTML de la página, cómo escribir titulares, resúmenes, cómo y dónde enlazar a otras páginas, etc.</p><p>Por último, recordar que aparte de todo lo que hemos comentado aquí y podamos leer en cualquier otro artículo similar, no hay que olvidar la documentación oficial de cada uno de los buscadores, así como las herramientas que ellos mismos facilitan a los webmasters:</p><ul><li><a href="http://www.google.es/bot.html" title="GoogleBot">Información sobre GoogleBot</a></li><li><a href="http://www.google.com/webmasters/tools/" title="Google Webmaster Tools">Google Webmaster Tools</a></li><li><a href="http://help.yahoo.com/help/us/ysearch/slurp/index.html" title="Yahoo! Slurp">Información sobre Yahoo! Slurp</a></li><li><a href="http://siteexplorer.search.yahoo.com/" title="Yahoo! Site Explorer">Yahoo! Site Explorer</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/06/21/cabalgando-los-gusanos/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>lighttpd 1.4.15 para Debian Sarge</title><link>http://www.bisente.com/blog/2007/04/14/spanish-lighttpd-1415-para-debian-sarge-spanish-english-lighttpd-1415-for-debian-sarge-english/</link> <comments>http://www.bisente.com/blog/2007/04/14/spanish-lighttpd-1415-para-debian-sarge-spanish-english-lighttpd-1415-for-debian-sarge-english/#comments</comments> <pubDate>Sat, 14 Apr 2007 10:55:59 +0000</pubDate> <dc:creator>bisente</dc:creator> <category><![CDATA[English]]></category> <category><![CDATA[lighttpd]]></category><guid isPermaLink="false">http://www.bisente.com/blog/2007/04/14/spanish-lighttpd-1415-para-debian-sarge-spanish-english-lighttpd-1415-for-debian-sarge-english/</guid> <description><![CDATA[I&#8217;ve updated my lighttpd packages for Debian Sarge to the 1.4.15 release. Find them here.]]></description> <content:encoded><![CDATA[<div class="jLanguage"><ul><li><a href="?lan=english"><img alt="english" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/en.png" /></a></li><li><a href="?lan=spanish"><img alt="spanish" src="http://www.bisente.com/wp-content/plugins/jLanguage/icons/es.png" /></a></li></ul></div><p>I&#8217;ve updated my lighttpd packages for Debian Sarge to the 1.4.15 release. Find them <a href="/packages/lighttpd/1.4.15" title="lighttpd 1.4.15 Debian Sarge">here</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.bisente.com/blog/2007/04/14/spanish-lighttpd-1415-para-debian-sarge-spanish-english-lighttpd-1415-for-debian-sarge-english/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using disk: enhanced
Database Caching 4/67 queries in 0.025 seconds using apc
Object Caching 1123/1245 objects using apc

Served from: www.bisente.com @ 2012-02-12 17:27:47 -->
