How to redirect www to no-www in Lighttpd

This is pretty easy and is more of a personal note. First check that mod_redirect is enabled in lighttpd.conf:

[code lang=”bash”]sudo nano /etc/lighttpd/lighttpd.conf[/code]

Uncomment the line that write “mod_redirect”.

[code lang=”bash”]server.modules = (
“mod_rewrite”,
“mod_access”,
“mod_alias”,
“mod_accesslog”,
“mod_compress”,
“mod_redirect”,
…[/code]

Then add the following at the bottom of your lighttpd.conf:

[code lang=”bash”]$HTTP[“host”] =~ “^www.(.)” {
url.redirect = ( “^/(.
)” => “http://%1/$1″ )
}[/code]

Finally, give lighttpd a restart and test it out:

[code lang=”bash”]sudo /etc/init.d/lighttpd restart[/code]

Hope it helps.

After I made the switch to Lighty, I totally forgot to do redirect all my www sites to no-www, this results in all people who visit www.darylli.com to be shown the default site which is what you see here basically.

Bye Apache, Hi Lighty

As planned, Apache is no more. Say hi to Lighty

Lighttpd logo fly light

Made a few silly mistakes along the way and almost accidentally deleted my folder of pictures even. Things got a little more responsive. I haven’t used any caching solutions for WordPress. Caching is going to be tough work.

I just let PHP CGI spawn happily:

[code lang=”bash”]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2655 www-data 16 0 99816 31m 3804 S 0 12.4 0:22.67 php-cgi
2651 www-data 16 0 96060 29m 3308 S 0 11.6 0:04.91 php-cgi
2656 www-data 16 0 93976 26m 3968 S 0 10.2 0:24.59 php-cgi
2654 www-data 16 0 94008 26m 3856 S 0 10.2 0:24.88 php-cgi
2653 www-data 16 0 91612 25m 3200 S 0 9.8 0:03.52 php-cgi
2657 www-data 16 0 89840 22m 3784 S 0 8.7 0:24.06 php-cgi
2652 www-data 16 0 89580 22m 3980 S 0 8.6 0:04.27 php-cgi
2650 www-data 16 0 86716 20m 3196 S 0 8.0 0:03.94 php-cgi
2313 mysql 15 0 139m 17m 4368 S 0 6.7 0:19.83 mysqld
2649 www-data 23 0 71676 6232 3708 S 0 2.4 0:00.01 php-cgi
2647 www-data 23 0 71676 6224 3708 S 0 2.4 0:00.02 php-cgi
2672 root 15 0 53468 2696 2136 S 0 1.0 0:00.00 sshd
2645 www-data 15 0 55084 2628 892 S 0 1.0 0:00.22 lighttpd
2433 root 15 0 36676 2124 1676 S 0 0.8 0:00.00 master[/code]

Lighttpd don’t exactly take up a lot of resources too.

Tonight I’ll fix the server

It’s been requiring almost a daily restart. I think it’s probably MySQL or Apache’s fault. Or perhaps it’s just my fault for being a miser not wanting to pay for more. Either way, I’m going to fix it. So far, I’m done with the virtual hosts. Lighttpd isn’t as hard as I thought. PHP is working fine already. I’m still in the midst of testing if WordPress works. Once I’m done with that, it’s “sudo apt-get remove apache2”.

Reddit is now open-source

Reddit decides to go open source. Reddit is already using open source software – Debian, lighttpd, HAProxy, PostgreSQL, Slony-I, various python libraries, Psychopg, pylons, Solr, Tomcat, Ganglia, Mercurial, Git, gettext (translation), daemontools, and memcached. The only thing that isn’t open source is Reddit itself so they decide to open source it.

(Souce: Reddit)

Oh so that’s what the penguin is about.