Linux and Open Source Blog

  • Home
  • WordPress Plugins
  • About
  • Contact

Reduce Apache Load With lighttpd On Debian Etch Linux

Posted on February 13, 2008 by Linewbie.com Posted in applications/software, guides, how to, servers .

Lighttpd, 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 Requirements

To install such a system you will need the following:

  • The Perfect Setup – Debian Etch (Debian 4.0)
  • Installing Lighttpd With PHP5 And MySQL Support On Debian Etch

2 Setting up lighttpd

Once 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 proxy

To 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.
Using the Perfect Setup tutorial this module will either be there already but not activated.

a2enmod proxy_http
a2enmod proxy_connect

If you are using virtual hosting, you will want to use the following code to set up a proxy between the applicable directives:

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.

The increase of performance you’ve gained so far with Lighttpd is not phenomenal, but helps to increase the website performance and reduces the load on your server.

5 Links

  • Lighttpd: http://www.lighttpd.net
  • Apache Module mod_proxy: http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
  • PHP: http://www.php.net
  • MySQL: http://www.mysql.com
  • Debian: http://www.debian.org
Tags: apache, debian, etch, Lighttpd, server .
« Installing Lighttpd With PHP5 And MySQL Support On Fedora 8
WP Post Icon »

Leave a comment

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Does an un-confirmed Bitcoin transaction expire?
  • Looting of the Fox: The Story of Sabotage at ShapeShift
  • Decentralization, Scalability, and Fault Tolerance of Bitcoin
  • Stripe will soon accept Bitcoin payments
  • Zynga announces Bitcoin acceptance in game
  • How to import very large sql dump via phpmyadmin
  • How to compare the content of two folders automatically
  • Top 5 reasons to start experimenting with Linux
  • The day our mind became open sourced
  • Mark Shuttleworth wants to turn canonical (ubuntu) into the next Apple Inc.

Categories

  • applications/software (26)
    • browsers (2)
    • development (1)
    • information management (1)
    • Mobility (1)
    • multimedia (5)
    • office suites (2)
    • security (6)
    • servers (6)
    • system (2)
  • audio/video/pics (3)
  • Bitcoin (3)
  • books & literature (1)
  • cms/portals (1)
  • desktop environments (7)
    • gnome (2)
    • kde (5)
  • events/shows (3)
    • interviews (1)
    • people (1)
    • surveys (1)
  • games & gaming (2)
  • general topics (4)
  • guides (112)
    • how to (105)
    • tips (87)
    • tutorials (86)
  • hardware (8)
    • desktop & laptop pc (5)
    • gadgets & mobiles (2)
  • howtoforge (47)
  • internet/web (4)
    • design & development (2)
  • linux and open source blog (49)
  • linux.com (76)
  • linux/unix/os distros (113)
    • debian/ubuntu based (10)
    • mac/osx (2)
    • other distros (3)
  • news (217)
  • open source (8)
    • business & foss (2)
  • other (26)
    • uncategorized (26)
  • Programming (3)
    • PHP (2)
  • quotes & thoughts (10)
  • random stuff (4)
    • cool stuff (3)
    • funny stuff (1)
  • review/preview/tests (7)
  • wordpress/blogging (3)

Archives

  • July 2016
  • April 2016
  • January 2015
  • April 2014
  • January 2014
  • November 2013
  • February 2013
  • November 2012
  • April 2012
  • March 2012
  • January 2012
  • December 2011
  • August 2011
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2006

Recent Posts

  • Does an un-confirmed Bitcoin transaction expire?
  • Looting of the Fox: The Story of Sabotage at ShapeShift
  • Decentralization, Scalability, and Fault Tolerance of Bitcoin
  • Stripe will soon accept Bitcoin payments
  • Zynga announces Bitcoin acceptance in game
  • How to import very large sql dump via phpmyadmin
  • How to compare the content of two folders automatically
  • Top 5 reasons to start experimenting with Linux
  • The day our mind became open sourced
  • Mark Shuttleworth wants to turn canonical (ubuntu) into the next Apple Inc.

Categories

  • applications/software (26)
    • browsers (2)
    • development (1)
    • information management (1)
    • Mobility (1)
    • multimedia (5)
    • office suites (2)
    • security (6)
    • servers (6)
    • system (2)
  • audio/video/pics (3)
  • Bitcoin (3)
  • books & literature (1)
  • cms/portals (1)
  • desktop environments (7)
    • gnome (2)
    • kde (5)
  • events/shows (3)
    • interviews (1)
    • people (1)
    • surveys (1)
  • games & gaming (2)
  • general topics (4)
  • guides (112)
    • how to (105)
    • tips (87)
    • tutorials (86)
  • hardware (8)
    • desktop & laptop pc (5)
    • gadgets & mobiles (2)
  • howtoforge (47)
  • internet/web (4)
    • design & development (2)
  • linux and open source blog (49)
  • linux.com (76)
  • linux/unix/os distros (113)
    • debian/ubuntu based (10)
    • mac/osx (2)
    • other distros (3)
  • news (217)
  • open source (8)
    • business & foss (2)
  • other (26)
    • uncategorized (26)
  • Programming (3)
    • PHP (2)
  • quotes & thoughts (10)
  • random stuff (4)
    • cool stuff (3)
    • funny stuff (1)
  • review/preview/tests (7)
  • wordpress/blogging (3)

Archives

  • July 2016
  • April 2016
  • January 2015
  • April 2014
  • January 2014
  • November 2013
  • February 2013
  • November 2012
  • April 2012
  • March 2012
  • January 2012
  • December 2011
  • August 2011
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2006
Privacy Policy

Est. 2002

linewbie.com serving the linux and open source community since April 09, 2002

CyberChimps WordPress Themes

© Linux and Open Source Blog