PyLucid CMS Logo

use lighttpd instead of apache

Here examples how to use PyLucid with lighttpd.

↑ install lighttpd  #

Bash
1
2
3
4
5
~$ sudo aptitude install lighttpd
~$ cd /etc/lighttpd/
/etc/lighttpd# mv lighttpd.conf lighttpd.conf.bak
/etc/lighttpd# touch lighttpd.conf
/etc/lighttpd# nano lighttpd.conf

↑ lighttpd.conf  #

Example for a /etc/lighttpd/lighttpd.conf:

Unbekannter Typ
server.modules = (
	"mod_access",
	"mod_alias",
	"mod_compress",
        "mod_rewrite",
        "mod_fastcgi",
)

server.document-root        = "/var/www"
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"

index-file.names            = ( "index.html", "index.htm" )

url.access-deny             = ( "~", ".inc", ".db" )

static-file.exclude-extensions = ( ".fcgi", )

## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl"

## http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModDirlisting
#server.dir-listing  = "enable"
server.dir-listing   = "disable"
dir-listing.encoding = "utf-8"

## http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModCompress
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype  = (
    "application/javascript",
    "application/x-javascript",
    "text/css", "text/html", "text/plain"
)

include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"


## Example for setup "Site1":
$HTTP["host"] == "www.YourSite1.tld" {
    server.document-root = "/var/www/YourSite1"

    # http://redmine.lighttpd.net/wiki/lighttpd/Docs%3AModFastCGI
    fastcgi.server = (
        "/index.fcgi" => (
            "main" => (
                "socket" => "/tmp/site1_fastcgi_server.sock",
                "bin-path" => "/var/www/YourSite1/index.fcgi",
                "check-local" => "disable",
                
                ## the number of fastcgi processes that will be started (default is 4):
                #"max-procs" => 1,
            )
        ),
    )

    alias.url = (
        "/media" => "/var/www/YourSite1/media/",
    )

    url.rewrite-once = (
        "^(/media.*)$" => "$1",

        "^/favicon\.ico$" => "/favicon.ico",
        #"^/favicon\.ico$" => "/media/favicon.ico",

        "^(/.*)$" => "/index.fcgi$1",
    )
}

## Partial example for setup "Site2":
$HTTP["host"] == "www.site2.tld" {
    server.document-root = "/var/www/YourSite2"
    fastcgi.server = (
       ...
    )
    ...
}

↑ local_settings.py  #

Importend is that you add FORCE_SCRIPT_NAME into your local_settings.py:

Python
1
FORCE_SCRIPT_NAME = ""

See also: https://code.djangoproject.com/ticket/11694

↑ control lighttpd  #

To restart lighttpd run this:

Bash
1
sudo /etc/init.d/lighttpd restart
0 Kommentare für 'use lighttpd':
    Es existiert kein Kommentar für 'use lighttpd'
Kommentar hinterlassen
tag navi deployment | lighttpd

django-processinfo: 6.0 ms of 241.8 ms (2.5%)