Lighttpd: Installation and configuration of the Web server
Table of Contents |
1 .- Introduction
Lighttpd is a web server operating systems for Unix / Linux and Microsoft Windows. This server also known as Light year, is an alternative for the Apache web server.
This diseado to be safe, quick (very quick to tell the truth), compatible with the standards and flexible at the same time that this optimized for environments where speed is critical. Its memory footprint is very small (in comparison to other web servers), a light load on the CPU speed and his approach makes perfect lighttpd server load too.
2 .- Installation on Debian
To install lighttpd, type, as root:
deathbian: ~ # aptitude install lighttpd Note: On Debian Lenny, lighttpd runs with the user www-data, and not lighttpd.
3 .- Basic Configuration
The install on Debian provides us with the configuration files and boot Light year, but if you need some examples
| file: / etc / lighttpd / lighttpd.conf |
# Debian lighttpd configuration file # ############ Options you really have to take care of #################### # # Modules to load # Mod_access, mod_accesslog and mod_alias are loaded by default # All other module should only be loaded if neccesary # - Saves some time # - Saves memory server.modules = ( "mod_access" "mod_alias" "mod_accesslog" "mod_compress" "mod_fastcgi" # "Mod_rewrite" # "Mod_redirect" # "Mod_status" # "Mod_evhost" # "Mod_usertrack" # "Mod_rrdtool" # "Mod_webdav" # "Mod_expire" # "Mod_flv_streaming" # "Mod_evasive" ) fastcgi.server = (. "php" => (( "bin-path '=>" / usr / bin / php-cgi " "socket" => "/ tmp / php.socket" ))) # # A static document-root, for virtual-hosting take look at the # # * Server.virtual-options server.document-root = "/ var / www /" # # Where to send messages to error - server.errorlog = "/ var / log / lighttpd / error.log" # # Files to check for if ... / is requested index-file.names = ( "index.php", "index.html" "index.htm", "default.htm" "index.lighttpd.html") # # Use the "Content-Type" extended attribute to obtain mime type if possible # Mimetype.use-xattr = "enable" # # # # Accesslog module accesslog.filename = "/ var / log / lighttpd / access.log" # # Deny access the file-extensions # # ~ Is for backupfiles from vi, emacs, joe, ... #. Inc is often used for code which includes in general should not be part # Of the document-root url.access-deny = ( "~". "inc") # # # Which extensions should not be handle via static-file transfer # #. Php,. Pl,. Fcgi are most often handled by mod_fastcgi or mod_cgi file.exclude-static-extensions = (. "php". "pl", ". fcgi") ######### Options that are good but not to be neccesary to be changed ####### # # Bind to port (default: 80) # Server.port = 81 # # Bind to localhost only (default: all interfaces) # # Server.bind = "localhost" # # Error-handler status for 404 # server.error-handler-404 = "/ error-handler.html" # server.error-handler-404 = "/ error-handler.php" # # To help the rc.scripts server.pid-file = "/ var / run / lighttpd.pid" # # # # Format: |
With Light installed and working properly and we are not going to use Apache 1.3/2.x, so what better remove the system (Remember to make backup data and Apache configuration files), typing:
deathbian: ~ # aptitude remove apache2 3.1 .- Setting the directives of national lighttpd
- server.document-root = / var / www / html specifies the directory by default to the sites.
- server.port = 80 Specifies the default port for the server.
- server.username = www-data user in Debian on which runs Light year.
- server.groupname = www-data Specifies the user name and group with which starts / stops the server daemon lighttpd. This is a safety feature, so in this manner does not run with root privileges.
- server.bind = server-ip-address specifies the IP address of the server. So it is also possible to enter a hostname or localhost.
- server.tag = lighttpd is used to assign the name and version number of lighttpd (default). This is a safety feature. You can configure this way:
server.tag = "My web server v1.0"Note: This is the name that brings the server in response to his bedside. You can check by using Netcraft.
- server.errorlog = / var / log / lighttpd / error.log Specifies the log file of error.
- accesslog.filename = / var / log / lighttpd
- Specifies the log file accesses, which can be used by an application of statistics of visitors as webalizer.
- index-file.names = (index.php, index.html) A listing of files in each directory by default.
- server.modules = (
Mod_access,
Mod_accesslog,
Mod_fastcgi,
Mod_rewrite,
Mod_auth
): The modules described above will be the only charge that Light year. Of course it is possible to add more. From here the secret of speed and low memory consumption on the server, we see a more detailed description:- mod_access: The access module is used to deny access to certain files.
- mod_accesslog: Used to write the blog CLF, flexible apache.
- mod_fastcgi: Support for FastCGI Perl / PHP etc.
- mod_rewrite: Necessary to rewrite Url's SEO compatible.
- mod_auth: Authentication, usually for password-protected directories.
mimetype.assign = (
. Pdf => application / pdf,
. Sig => application / pgp-signature
): Used to allocate the mapping of the Mimetype.
Edit the file / etc / lighttpd / lighttpd.conf and all the directives set out above.
deathbian: ~ # vim / etc / lighttpd / lighttpd.conf 4 .- Checking the web service
Since everything is configured to our needs we will save the file and start the daemon lighttpd:
deathbian: ~ # / etc / init.d / lighttpd start If you want to check which services are running and on which port to verify the successful installation of our lighttpd, type:
deathbian: ~ # netstat-ntulp Active Internet connections (servers only) Proto recv-Q Send-Q Local Address Foreign Address State PID / Program name tcp 0 0 127.0.0.1:3306 0.0.0.0: * LISTEN 2522/mysqld tcp 0 0 0.0.0.0:111 0.0.0.0: * LISTEN 2151/portmap tcp 0 0 0.0.0.0:80 0.0.0.0: * LISTEN 2720/lighttpd tcp 0 0 0.0.0.0:113 0.0.0.0: * LISTEN 2742/inetd tcp 0 0 0.0.0.0:21 0.0.0.0: * LISTEN 2927/tcpsvd tcp 0 0 0.0.0.0:443 0.0.0.0: * LISTEN 2720/lighttpd tcp 0 0 127.0.0.1:831 0.0.0.0: * LISTEN 2775/famd tcp6 0 0::: 22::: * LISTEN 2444/sshd udp 0 0 0.0.0.0:32768 0.0.0.0: * 2432/lwresd udp 0 0 0.0.0.0:32770 0.0.0.0: * 2793/avahi-daemon: udp 0 0 0.0.0.0:517 0.0.0.0: * 2742/inetd udp 0 0 0.0.0.0:518 0.0.0.0: * 2742/inetd udp 0 0 127.0.0.1:921 0.0.0.0: * 2432/lwresd udp 0 0 0.0.0.0:5353 0.0.0.0: * 2793/avahi-daemon: udp 0 0 0.0.0.0:111 0.0.0.0: * 2151/portmap udp6 0 0::: 32769::: * 2432/lwresd
Now go to your browser, either Firefox or Internet Explorer and verify that our new website accessible via web, type in the address bar of your browser
http://localhost/ or http://127.0.0.1/
5. Final words
From personal experience, I can assure you that the performance of Apache is much lower compared to lighttp.
Light may be very young (in comparison to other systems, web servers), their search for responding to the reality of our days, the web2.0 which requires higher performance for sites with thousands of visitors daily.
Over the next few days will post items like;
Optimizing the web server lighttpd
- Configuring PHP FastCGI on lighttpd
- Configuration of virtual hosting on lighttpd
- Compile and optimize php scripts on lighttpd with php eAccelerator
- Solving Problems with the cache eAccelerator
Strengthening the security of lighttpd
- Extreme Web server security: Setting lighttpd, php, perl, MySQL with support for an environment of virtual file system (chrooted jail)
- SSL Configuration
- Create and use our own SSL certificate in lighttpd
- With password protection; to directories
Miscellaneous configuration lighttpd
- Installing and configuring the statistics Webalizer for lighttpd
- URLs for wordpress SEO compatible with lighttpd
- Deny direct links or theft of images (leeching) with lighttpd
Monitoring server lighttpd
- Monitor and restart the service lighttpd when it crashes.
Popularity: 25% [?]
10 comments to "lighttpd: Installation and configuration of the Web server"
Trackback URI | Comments RSS



on 02 Sep 2007 at 10:48 am # Mini Case Study: Apache 2 vs lighttpd 1.x
[...] As we look at the howto install lighttpd on our server [...]
on 08 Sep 2007 at 8:11 pm # leandro
Teacher documentation you got to do with walking perl bugzilla and I want to install a humpback ta toq .. thanks
[Reply]
on 09 Sep 2007 at 12:39 pm # leandro
Thank you add the master module cgi autonomous and already andavo ..
[Reply]
on 14 Sep 2007 at 1:12 pm # fher98
With perl? decisive FastCGI / Perl ... Well if I'm not the evil and brings the support FastCGI, tell us how you go!
Greetings
[Reply]
on 04 Oct 2007 at 2:23 pm # Paul
Excellent article. I served as a reference. Thank you.
[Reply]
on 04 Oct 2007 at 2:28 pm # fher98
@ Paul: Thank you for your comment, if there is another topic that interests you and if we can help you, be happy.
[Reply]
on 22 Jan 2008 at 1:51 pm # Poly
Good guys, I have the following problem / problemon
I have installed Ruby on Rails, the theme I installed by the apt-get lighttpd but when I see the mod that load, ohhh boy is not that of mod_fastcgi
Why this happens? as I solve it?, is that if I did not throw error and I can not lift it to come from outside
Sincerely, Poli
[Reply]
fher98 replied on February 12th, 2008:
Poly @: In the file / etc / lighttpd / lighttpd.conf looking for an option to cancel and server.modules (remove the #) the line that reads "mod_fastcgi", and thus already be enabled.
Greetings
[Reply]
on 31 Mar 2008 at 2:27 am # darkfrog
Greetings ..
which would be suitable for the configuration that each has its own virtualhost error.log and access.log, with the aim of bringing the statistics of each virtual.
The default configuration does not permit me to have is configruacion!
[Reply]
on 10 Jun 2008 at 3:26 pm # owen
can you help me configure lighttpd for django?
My case is:
I created my project "ooo" in home / ecoia / django_projects /
but I can not hacerlocorrer in lighttpd
Owen ...
[Reply]