lighttpd instead of Apache?
I was just wondering if anyone has considered using / is using lighttpd (http://www.lighttpd.net/
Lighttpd seems to be designed to take up a small amount of memory - one of the areas in which linodes are limited.
If you are using it, what are your experiences? Does it take up less memory than apache? Is it stable? Is it hard to configure?
Thanks
15 Replies
No fast CGI, not much in the way of functionality at all. But for a basic web server, it does the job
As for virtual hosts, I believe he already mentioned that he had 3 running.
textdrivebenchmarking
@hallow:
I'm about to give lighttpd a try myself. Looks like the folks over at
love it. Especially check out the textdrivepost. benchmarking
Well, I've gotten it up and running (
Adam
@adamgent:
Any one know what lighttpd is like for perl scripts and ssl?
Adam
You have to run a separate process for ssl.
Perl scripts have to be run as a cgi or fcgi.
If not, maybe whoevers doing the hosted mysql service could offer a hosted php service.
@Jay:
@adamgent:Any one know what lighttpd is like for perl scripts and ssl?
Adam
You have to run a separate process for ssl.
Perl scripts have to be run as a cgi or fcgi.
But don't be too concerned about the seprate process thing. They can share the same backend (both of mine use the same PHP), so the total ram useage increase is about 600k (which is about 1/2 of what the first process uses for me).
PHP is kind of a hog (uses about 48m between all the processes here), I'm sure perl is too. Maybe after after lighttp dev starts to slow down we can get them to work on a new scripting language.
Combined with SQLite and I'm a happy camper with my UML Linode 80.
The only oddity is when he runs it with IPv6 enabled, all v6-based requests that hits lighttpd is returned up to precisely 16K worth of data before lighttpd closes the connection.
No obvious config file or code issue. He can get > 16K with any other v6-based apps, so don't think the issue is with his TCP stack.
Just FYI, in case you need to run lighttpd with IPv6; test!
Other than that, looks to be pretty good.
For example, the following will make the default dir for fastcgi scripts to be /
cd /
/etc/init.d/lighttpd restart
And the following will make the default dir for fastcgi scripts to be /usr/bin:
cd /usr/bin
/etc/init.d/lighttpd restart
Whether this is a serious security flaw or merely a compatibility annoyance with scripts that run fine in Apache can be debated elsewhere. But knowing about it helps avoid issues.
The vhosts system looks like it might make more sense if you're literally hosting sites as:
* /websites/example1.com
/websites/example2.com
/websites/example3.com
But if you wanted to do anything more exotic, you'd need to write lots of rewrite rules, by the looks of things. Anyone tried this at all? Is it faster than the equivalent Apache setup? (I should imagine if you're using 'simple vhosts' like above, it would in all probability be faster)
Also, it's not overly clear from the lighttpd website whether URL rewriting is specified in the main configuration file, or whether it can be set per-directory like in Apache's .htaccess files. If not, that could be quite a limitation which would put me - and probably others - off.
It seems that lighttpd might work better for what I want than Apache might, but I'm not yet sure.
Has anyone here tried this?
@Arantor:
Just wondered if anyone had tried lighttpd with virtual hosts and url-rewriting?
snip
It seems that lighttpd might work better for what I want than Apache might, but I'm not yet sure.
Has anyone here tried this?
I've been running lighttpd for a few months now, using URL Rewriting to get decent URLs from Gallery. I'm doing vhosting via the HOST variable. For example:
$HTTP["host"] == "www.moregruel.net" {
server.document-root = "/var/www/wordpress"
alias.url = ("/gallery/" => "/usr/share/gallery/", "/gallery" => "/usr/share/gallery", "/albums" => "/var/www/albums")
url.rewrite = (
"^/gallery/([^\.\?/]+)/([0-9]+)$" =>
"/gallery/view_photo.php?set_albumName=$1&index=$2",
"^/gallery/([^\.\?/]+)/([A-Za-z_0-9\-]+)$" =>
"/gallery/view_photo.php?set_albumName=$1&id=$2",
*and so on*
So rewriting is not per-directory via .htaccess, but since you pattern match, you can make it per-directory. It's considerably faster overall than apache 1 on my machine, mostly due to lower memory use. Whether this would meet your needs is up to you.
Steve