Inércia Sensorial


A verdadeira face de Starcraft

Filed under: Imagem — inerte @ 14:35

Algo nessa imagem atingiu minhas memórias dos idos tempos madrugueiros apenas no Starcraft.

Show de Sepukku?



Quem são essas pessoas no DVD do Windows Vista?

Filed under: Imagem — inerte @ 17:54

Acharam essas imagens holográficas no DVD do Windows Vista… três seres olhando com cara de nada. Não tenho a mínima idéia quem são!

DVD Cover 1

DVD Cover 2

DVD Cover 3

via Kwisatz


Lighttpd with Apache

Filed under: Perils of Software Development — inerte @ 00:22

One of my websites is experiencing phenomenal growth and after optimizing the database queries and using memcached, I decided it was time to use another webserver to serve static media. Here’s how to do it.

I recommend that you take a look on a previous post that I wrote about how to configure a webserver to work with Django because I will be manipulating some files which I talked about there. If you’re unsure about the correct paths necessary for your server, use the other post as a guide. I installed Lighttpd and configured Apache on my Slicehost VPS, which is a company that I highly recommend. If you decide to sign-up with them, it would be awesome if you use my email ([email protected]) as a referral, and/or use this link which takes care of setting me as your referral.

We’re going to use Lighttpd on a different port than Apache to serve files from a specific directory based on the domain name, all transparent to the users browsing your website. No changes were made on my website code, server (Python) or client (HTML) side.

Install Lighttpd

My server runs Ubuntu so I just ran the following command to install Lighttpd:

$ apt-get install lighttpd

Edit Lighttpd’s configuration file:

$ vi /etc/lighttpd/lighttpd.conf

Uncomment the server.port line (mine was the 60th):

server.port               = 81

Enable the mod_evhost module. This will help us use a different directory depending on the domain name. Just uncomment the 19th line (inside server.modules).

Add the following somewhere, which says requests from should look for files on /var/www/ I did on the 118th line, after the evhost.path-pattern examples.

$HTTP["host"] =~ "yourdomain\\.com" {
    evhost.path-pattern = "/var/www/"

Start Lighttpd:

$ /etc/init.d/lighttpd start

Point your browser to your server to see if Lighttpd is working:


You need to see something like this (click the image for a larger version):

Lighttpd default page

If you have directories under /var/www/, append its names to the url to see if lighttpd is correctly serving them (it should):


Configure Apache

To transparently serve files using Lighttpd from Apache, you need to enable proxy on Apache:

$ ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/
$ ln -s /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/
$ ln -s /etc/apache2/mods-available/proxy_connect.load /etc/apache2/mods-enabled/
$ ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled/

Unsecured proxies are used by spammers so Apache comes guarded against bad configurations. You need to edit this file:

$ vi /etc/apache2/mods-available/proxy.conf

To say where the proxy will work and who has access to it. Replace the * with, and uncomment the Allow from line. Final result is this:

        AddDefaultCharset off
        Order deny,allow
        Deny from all
        Allow from

Configure the VirtualHost

$ vi /etc/apache2/sites-available/

Add this somewhere inside <VirtualHost>:

ProxyRequests Off
ProxyPreserveHost On
ProxyPass /web
ProxyPassReverse /

You’re done with all configurations. Now reload the Apache’s modules and restart the server:

$ /etc/init.d/apache2 reload
$ apache2ctl restart

Everything should be working. If you get an error, try to undo some steps and after each change, reload Apache and restart Apache and Lighttpd to see when it broke. If you browse to http://your.ip.address, you should see all your content from /web/ being loaded correctly. How do you tell it’s being served by Lighttpd instead of Apache?

This should tell you Apache is serving the page:

curl -I http://your.ip.address/

While this should tell you Lighttpd is serving the file:

curl -I http://your.ip.address/web/some.file

If you have any doubts or have problems, please comment and I will try to help you.

Powered by WordPress