Skip to main content

Sample lighttpd conf file for ssl and non ssl

Non SSL


# Default configuration file for the lighttpd web server
# Start using ./script/server lighttpd

server.port = 3000
server.name = "localhost"
server.modules           = ( "mod_rewrite", "mod_accesslog") #, "mod_fastcgi" )
#server.error-handler-404 = "/dispatch.fcgi"
server.document-root     = "/home/myapp/"

server.errorlog          = "/home/myapp/log/lighttpd.error.log"
accesslog.filename       = "/home/myapp/log/lighttpd.access.log"

url.rewrite              = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
#server.document-root = "/home/myapp/"

# Change *-procs to 2 if you need to use Upload Progress or other tasks that
# *need* to execute a second request while the first is still pending.

fastcgi.server = ( ".fcgi" =>
  ( "localhost" =>
      (
        "min-procs" => 10,
        "max-procs" => 10,
        "socket"    => "/home/myapp/tmp/sockets/fcgi.socket",
        "bin-path"  => "/home/myapp/public/dispatch.fcgi",
        "bin-environment" => ( "RAILS_ENV" => "development" )
      )
  )
)

mimetype.assign = (
  ".css"        =>  "text/css",
  ".gif"        =>  "image/gif",
  ".htm"        =>  "text/html",
  ".html"       =>  "text/html",
  ".jpeg"       =>  "image/jpeg",
  ".jpg"        =>  "image/jpeg",
  ".js"         =>  "text/javascript",
  ".png"        =>  "image/png",
  ".swf"        =>  "application/x-shockwave-flash",
  ".txt"        =>  "text/plain"
)

# Making sure file uploads above 64k always work when using IE or Safari
# For more information, see http://trac.lighttpd.net/trac/ticket/360
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
  server.max-keep-alive-requests = 0
}



SSL


# Default configuration file for the lighttpd web server
# Start using ./script/server lighttpd

server.port = 443

server.modules           = ( "mod_rewrite", "mod_accesslog", "mod_fastcgi" )
server.error-handler-404 = "/dispatch.fcgi"
server.document-root = "/home/myapp/public/"

  ssl.engine = "enable"
  ssl.pemfile = "/etc/lighttpd/kannan.net/kannan.net.pem"
  ssl.ca-file = "/etc/lighttpd/kannan.net/kannan.net.crt"
  server.name = "your side name.com"
  server.errorlog = "/home/myapp/log/lighttpd.error.log"
  accesslog.filename = "/home/myapp/log/lighttpd-ssl.access.log"

url.rewrite              = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )

# Change *-procs to 2 if you need to use Upload Progress or other tasks that
# *need* to execute a second request while the first is still pending.
fastcgi.server = ( ".fcgi" =>
  ( "localhost" =>
      (
        "min-procs" => 1,
        "max-procs" => 1,
        "socket"    => "/home/myapp/tmp/sockets/fcgi.socket",
        "bin-path"  => "/home/myapp/public/dispatch.fcgi",
        "bin-environment" => ( "RAILS_ENV" => "development" )
      )
  )
)
mimetype.assign = (
  ".css"        =>  "text/css",
  ".gif"        =>  "image/gif",
  ".htm"        =>  "text/html",
  ".html"       =>  "text/html",
  ".jpeg"       =>  "image/jpeg",
  ".jpg"        =>  "image/jpeg",
  ".js"         =>  "text/javascript",
  ".png"        =>  "image/png",
  ".swf"        =>  "application/x-shockwave-flash",
  ".txt"        =>  "text/plain"
)

# Making sure file uploads above 64k always work when using IE or Safari
# For more information, see http://trac.lighttpd.net/trac/ticket/360
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
  server.max-keep-alive-requests = 0
}

Comments

Popular posts from this blog

Errno::ENOENT: No such file or directory

HTML to PDF conversion is very easy in rails and pdfkit will be useful in this case, wkhtmltopdf tool will be supporting tool so you can easily convert an html to pdf.  In my experience I used the following steps: gem install pdfkit -v 0.5.0 gem install wkhtmltopdf -v 0.1.2 gem install wkhtmltopdf-binary Some times this sequence will not work, so I use the following as per the instruction from  https://github.com/pdfkit/pdfkit/wiki/Installing-WKHTMLTOPDF Be careful to download the appropriate wkhtmltopdf tar ball, it depends on your os architecture, like i386 or 64 wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2 tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2 mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf chmod +x /usr/local/bin/wkhtmltopdf Try to convert html to pdf after restarting your web servers.  If you get any error like: Errno::ENOENT: No such file or directory then I have a str...

Rails 1.2.1 with Ruby 1.8.x installation tips

ROR Setup (Ruby 1.8.6 , patch level 111, rails 1.2.1, CentOs 6.2 62 bit, Postgres 8.3) Make sure rpmforge included in your yum.repo ‘s, you can make it is available through cd /tmp/ wget  http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm rpm --import  http://apt.sw.be/RPM-GPG-KEY.dag.txt rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm Download and install ruby 1.8.6 cd /tm/ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.bz2 tar jxf ruby-1.8.6-p111.tar.bz2  cd ruby-1.8.6-p111 ./configure make Note: If you found any error like make gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c array.c gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c bignum.c gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c class.c gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c...

Lighttpd with fastCGI for ROR 1.2.1

Lighttpd Installation: As of now (18-Feb-2011) the version 1.4.28 is the current version of lighttpd, which we need yo downloaded from  http://www.lighttpd.net/ tar -zxvf lighttpd-1.4.28.tar.gz cd lighttpd-1.4.28 ./configure ./configure --with-openssl Look at lighttpd is automatically mapped at /usr/local/sbin/lighttpd , so try to execute the version check command and the output will be very similar as: [root@kannan ~]# /usr/local/sbin/lighttpd -v lighttpd/1.4.28 (ssl) - a light and fast webserver Build-Date: Feb 17 2011 16:37:02 Then, note that there might be a new directory called /etc/lighttpd/ which will contains a default configuration file called "lighttpd.conf" This is the file which will contains the information about how  (ROR based) web application is going to act along with script/server. This file is same as webrick/config.rb  for Webricks, httpd.conf for Apche, web.config for IIS etc., Note:  The file <RAI...