• Optimizing the Web server: Apache 2 vs. Lighttpd 1.x
  • URL file-access is disabled in the server configuration
  • Synchronizing with OpenSSH - How to create and configure a public key in Linux
  • "/>

    ...::: Guatewireless.org ::::..

    Technology, Software Libre, Guatemala, Open Source, Linux, Wireless, WiFi, Scripting, Debian, CentOS, Gentoo, Redhat, SuSE, Windows

    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:  . html
     # # -> ..../status-404.html For 'File not found'
     # server.errorfile-prefix = "/ var / www /"
    
     # # Virtual directory listings
     dir-listing.encoding = "utf-8"
     server.de-listing = "enable"
    
     # # Send unhandled HTTP-header headers to error-log
     # debug.dump-unknown-headers = "enable"
    
     # # # Only root can use these options
     #
     # Chroot () to directory (default: no chroot ())
     # server.chroot = "/"
    
     # # Change uid to  (default: do not care)
     server.username = "www-data"
    
     # # Change uid to  (default: do not care)
     server.groupname = "www-data"
    
     # # # # Compress module
     compress.cache-dir = "/ var / cache / lighttpd / compress /"
     compress.filetype = ( "text / plain", "text / html, application / x-javascript", "text / css")
    
     # # # # Status module
     # Status.status-url = "/ server-status"
     # Status.config-url = "/ server-config"
    
     # # # # Url handling modules (rewrite, redirect, access)
     # Url.rewrite = ("^/$" => "/ server-status")
     # Url.redirect = ( "^ / wishlist /(.+)" =>" http://www.123.org/ $ 1 ")
    
     #
     # Define a pattern for the host url finding
     #%% =>% Sign
     #% 0 => domain name + tld
     #% 1 => tld
     #% 2 => domain name without tld
     #% 3 => subdomain 1 name
     #% 4 => subdomain 2 name
     #
     # Evhost.path-pattern = "/ home / storage / dev / www /% 3/htdocs /"
    
     # # # # Expire module
     # Expire.url = ( "/ buggy /" => "access 2 hours", "/ asdhas /" => "access plus 1 seconds 2 minutes")
    
     # # # # Rrdtool
     # Rrdtool.binary = "/ usr / bin / rrdtool"
     # Rrdtool.db-name = "/ var / www / lighttpd.rrd"
    
     # # # # Handle Debian Policy Manual, Section 11.5.  urls
     # # # # And by default allow them only from localhost
    
     $ HTTP [ "remoteip"] == "127.0.0.1" (
             alias.url + = (
                     "/ doc /" => "/ usr / share / doc /",
                     "/ images /" => "/ usr / share / images /"
             )
             $ HTTP [ "url"] = ~ "^ / doc / | ^ / images /" (
                     dir-listing.activate = "enable"
             )
     )
    
     # # # # Variable usage:
     # # Variable name without "."  is auto prefixed by "var."  and becomes "var.bar"
     # bar = 1
     # var.mystring = "foo"
    
     # # Integer add
     # bar + = 1
     # # String concat, with integer cast as string, result: "www.foo1.com"
     # server.name = "www."  + Mystring + + var.bar. "Com"
     # # Array merge
     # index-File.Name = (foo + ". php") + index-File.Name
     # index-File.Name + = (foo + ". php")
    
     # # # # External configuration files
     # # Mimetype mapping
     include_shell "/ usr / share / lighttpd / create-mime.assign.pl"
    
     # # Load enabled configuration files,
     # # Read / etc / lighttpd / conf-available / README first
     include_shell "/ usr / share / lighttpd / include-conf-enabled.pl"
    
     $ SERVER [ "socket"] == "443" (
       ssl.engine = "enable"
       ssl.pemfile = "/ etc / ssl / certs / lighttpd.pem"
     )
    

    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%



    Tagged as:

    14 Comments

    1. Tenes Master documentation to make it work with perl and I want to install bugzilla hunchbacked one toq ta .. thanks

    2. Thank you add master module and cgi and Andavo nomas ..

    3. With perl? you say the Fastcgi / Perl ... Well if I am wrong and brings the said support FastCGI, tell us how you go!

      Greetings

    4. Excellent article. She served as a reference. Thank you.

    5. @ Paul: Thank you for your comment, if there is another topic that interests you and if we can help you, with pleasure.

    6. 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

    7. 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!

    8. 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 ...

    9. 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!

    10. Do not forget to install

      aptitude install php5-cgi php5-cli

    Trackbacks

    1. Mini Case Study: Apache 2 vs. Lighttpd 1.x
    2. MySQL: Find and Replace Text with SQL | ...::: Guatewireless.org ::::..

    Please enter a comment

    Please note the following:
    Comments are moderated, so it can take in being published. No need to repeat his comment.
    Your email will never be revealed.

    Search terms


  • lighttpd
  • configure lighttpd
  • install lighttpd
  • lighttpd configuration
  • how to install lighttpd
  • lighttpd manual
  • lighttpd server
  • lighttpd web server
  • lighttpd configuration
  • php lighthttpd
  • lighttpd configuration
  • installation of lighttpd
  • lighttpd windows
  • Web server lighttpd [edit]
  • configure rrdtool
  • debian install lighttpd
  • debian lighttpd
  • lighttpd manual
  • how to install lighttpd on SuSE Enterprise
  • install lighttpd in debian
  • install lighttpd on windows
  • the file: web server
  • installing and configuring Apache to make linux web server is ubuntu server
  • install lighthttpd
  • lighttpd setup
  • web server centos
  • web server in centos
  • lighttpd configuration file
  • lighttpd config
  • webserver configuration centos
  • configuring lighttpd
  • configure apache on centos
  • directory configure lighttpd
  • configure lighttpd php
  • configure ligthttpd
  • configure a web server in centos
  • configure lighttpd
  • lighttpd virtual directories
  • django lighthttpd
  • lighttpd installation
  • installation and configuration of a web server under linux
  • lighthttpd install in ipod
  • lighthttp set
  • lighthttpd authentication
  • lighthttpd set
  • lightppd
  • lighttpd caching images
  • lighttpd configure router
  • lighttpd for windows
  • lighttpd not starting at the beginning
  • lighttpd security
  • lighttpd web server
  • manual installation and configuration of a web server with Ubuntu 9 10
  • modules that must be activated in the multimedia server lighttpd in ubuntu
  • lighttpd restart
  • Urara lighthttpd
  • 0 0 0 0:80
  • update lighttpd
  • enable conf-lighttpd add
  • lighttpd authentication