Lighttpd: Installation and configuration of web server
Table of Contents |
1 .- Introduction
Lighttpd is a web server for operating systems Unix / Linux and Microsoft Windows. This server also known as Lighty, is an alternative for the Apache Web server pages.
This diseï ¿½ ado to be safe, fast (very fast indeed), compatible with flexible STANDARS while is optimized for environments where speed is critical. Its memory footprint is very pequeï ¿½ a (in comparison to other web servers), a slight load on the CPU speed and its approach makes perfect lighttpd server is heavily loaded.
2 .- Installation on Debian
To install lighttpd, keyboards, as root:
deathbian: ~ # aptitude install lighttpd
Note: On Debian Lenny, lighttpd runs with the user www-data, not lighttpd.
3 .- Basic Configuration
The Debian installation provides configuration files and boot Lighty, 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 error-messages to server.errorlog = "/ var / log / lighttpd / error.log" # # Files to check for if ... / is requested index-File.Name = ( "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 includes Which should in general 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 to be but not to be changed ####### neccesary # # Bind to port (default: 80) # Server.port = 81 # # Bind to localhost only (default: all interfaces) # # Server.bind = "localhost" # # Error-handler for status 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 lighty installed and working correctly and not going to use Apache 1.3/2.x, so we remove the system better (Remember to take backup of data and apache configuration files), typing:
deathbian: ~ # aptitude remove apache2
3.1 .- Setting the basic directives for lighttpd
- server.document-root = ï ¿½ / var / www / HTMLi ¿½ Specifies the default directory for the sites.
- server.port = 80 Specifies the default server port.
- server.username = www ¿½ ï ¿½ User-Datai in which runs Debian on lighty.
- server.groupname = ï ¿½ ¿½ Datai www-Specifies the user name and group with which start / stop the server daemon lighttpd. This is a characterization ¿½ stica security, so in this way does not run with root privileges.
- ï ¿½ server.bind = server-ip-addressï ¿½ specifies the IP address of the server. Likewise it is also possible to enter a hostname or localhost.
- server.tag = lighttpdï ¿½ ï ¿½ It 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 on your server reports the response header. You can check using Netcraft.
- server.errorlog = ï ¿½ / var / log / lighttpd / error.logï ¿½ Specifies the error log file.
- accesslog.filename = ï ¿½ / var / log / lighttpdï ¿½
- Specifies the access log file, which can be used by an application of statistics of visitors as webalizer.
- index-File.Name = (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 debited lighty. Of course you can add more. Hence the secret of the rapidity and low consumption of server memory, see a more detailed description:- mod_access: The access module is used to deny access to certain files.
- mod_accesslog: Used to write the log CLF, flexible as Apache.
- mod_fastcgi: FastCGI Support for perl / PHP etc.
- mod_rewrite: Necessary to rewrite Url's SEO compatible.
- mod_auth: authentication, usually for protected directories contraseï ¿½ a.
mimetype.assign = (
ï ¿½. pdfï ¿½ => ï ¿½ application / pdfï ¿½,
ï ¿½. sigi ¿½ => ï ¿½ application / pgp-signatureï ¿½
): Used to assign the mapping of the mimetype.
Edit the file / etc / lighttpd / lighttpd.conf and set all the policies described above.
deathbian: ~ # vim / etc / lighttpd / lighttpd.conf
4 .- The certificate of the web service
Since everything is configured to our needs, we record the file and start the lighttpd daemon:
deathbian: ~ # / etc / init.d / lighttpd start
If we want to verify which services are running and which port to check the success of our installation of lighttpd, type:
deathbian: ~ # netstat-ntulp Active Internet connections (only servers) 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 let the browser, either Firefox or Internet Explorer and verify that our new website is accessible via web, you 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.
Lighty can be very young (in comparison to other systems, Web servers), development seeks to address the reality of our days on which the higher performance required for web2.0 sites with thousands of visitors daily.
In the coming days we will post such topics as;
Optimizing lighttpd web server
- Setting up PHP FastCGI on lighttpd
- Configuration of virtual hosts on lighttpd
- Compile and optimize php scripts on lighttpd with php eAccelerator
- Solving Problems with eAccelerator cache
Strengthening security Lighttpd
- Extreme Web Server Security: Configure Lighttpd, php, perl, MySQL with support for an environment of virtual filesystem (chroot jail)
- SSL Settings
- Create and use our own SSL certificate on lighttpd
- Protect with password, directories
Miscellaneous Lighttpd Configuration
- Install and configure Webalizer statistics for lighttpd
- Compatible SEO URLs with lighttpd for wordpress
- Deny direct links or stolen pictures (leeching) with lighttpd
Monitoring Lighttpd server
- Monitor and restart the service when it crashes lighttpd.
Popularity: 19%
14 Comments
Trackbacks
- Mini Case Study: Apache 2 vs. Lighttpd 1.x
- MySQL: Find and Replace Text with SQL | ...::: Guatewireless.org ::::..






























Tenes Master documentation to make it work with perl and I want to install bugzilla hunchbacked one toq ta .. thanks
Thank you add master module and cgi and Andavo nomas ..
With perl? you say the Fastcgi / Perl ... Well if I am wrong and brings the said support FastCGI, tell us how you go!
Greetings
Excellent article. She served as a reference. Thank you.
@ Paul: Thank you for your comment, if there is another topic that interests you and if we can help you, with pleasure.
Good guys, I have the following little problem / problemon
I installed Ruby on Rails, the theme I installed by apt-get the lighttpd but when I loaded the mod, ohhh gosh not that of mod_fastcgi
Why is this happening? as I solve it? is that if I throw error and I can not lift it to come from outside
Greetings, Poli
@ Poli: In the / etc / lighttpd / lighttpd.conf server.modules looking for the option and uncomment (remove the #) the line that reads "mod_fastcgi", and thus already be enabled.
Greetings
Saludos ..
the configuration which would be adequate for each virtualhost has its own error.log and access.log, in order to bring the statistics of each virtual machine.
The default configuration does not allow me to have is configruacion!
can you help me configure Lighttpd for Django??
my case is:
I created my project "ooo" in home / ECOI / django_projects /
but I can not hacerlocorrer in lighttpd
Owen ...
Thank you very much for the tutorial. I have a question that I can not solve many guides you read. I need to enter my site, when I ask auth.module username and password through the user does not appear or appear and one fixed.
For example, if you leave the pop-up user: password: I want it to appear
well
user: admin # for example
password: # blank
or just
password: # blank
thanks!
Do not forget to install
aptitude install php5-cgi php5-cli
Ubuntu Web Server Guide