Reduce Apache's Load With lighttpd On Debian Etch
|
Submitted by axman (Contact Author) (Forums) on Thu, 2008-02-07 12:32. :: Debian | Apache | Lighttpd
Reduce Apache's Load With lighttpd On Debian EtchLighttpd, sometimes pronounced "Lighty", is a lightweight HTTP server that can help alleviate Apache's load by serving static content. Since Lighttpd uses less resources per request than Apache, it generally serves most static content faster than Apache. This tutorial shows how to install Lighttpd behind Apache via Apache´s proxy module. No guarantee that this will work for you!
1 RequirementsTo install such a system you will need the following:
2 Setting up lighttpdOnce Lighttpd is installed, you'll have to modify the configuration file to use it vi /etc/lighttpd/lighttpd.conf #bind to port (Default: 80) server.port = 81 # bind to localhost (recommended for proxy behind Apache, otherwise comment this out for all) server.bind = "localhost"This is not a full listing of the configuration file, but rather a highlight of the most important parts. Notice that we've set the server port to 81. By doing this, we're making sure it doesn't clash with Apache listening on port 80. If you wanted to let Lighttpd power your entire site instead of Apache, you can set this to port 80, or comment it out to accept the default. Then we restart Lighttpd: /etc/init.d/lighttpd restart
3 Setting up Apache's proxyTo let Apache take the output of Lighttpd on port 81 and map it to your website,
you'll need to make sure the Proxy module of Apache is loaded.
a2enmod proxy_http If you are using virtual hosting, you will want to use the following code to
set up a proxy between the applicable ProxyRequests Off ProxyPreserveHost On ProxyPass /media http://0.0.0.0:81/ ProxyPassReverse / http://0.0.0.0:81/ Then we restart Apache: /etc/init.d/apache2 reload
4 Final notice In the above example, Lighttpd will serve up your media folder, leaving Apache
to do the rest. Set this to any folder that has static content in it and Lighttpd
will serve it, instead of Apache. Another good use of Lighttpd would be to serve
up multimedia files, taking the load off of Apache. The increase of performance
you'll gain is dependent on many factors. If you only have Lighttpd serve up
your images, it probably won't help too much. You can put all of your static
content, including HTML and PDF files, images, and movies in a folder called
/static and then set the ProxyPass variable to that for a slightly better performance.
5 Links
|



Recent comments
7 hours 29 min ago
9 hours 46 min ago
12 hours 59 min ago
13 hours 48 min ago
13 hours 55 min ago
17 hours 44 min ago
18 hours 12 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 11 hours ago