Results 1 to 15 of 426

Thread: Инсталяция и настройка lighttpd

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Exclamation Инсталяция и настройка lighttpd

    Решил обновить начало темы, потому что вопрос заработает, или нет - уже не стоит.
    Заработает.
    Ну и чтобы всем все было понятно.
    1. Устанавливаем Lighttpd:
    ipkg install lighttpd
    2.Устанавливаем php:
    ipkg install php-fcgi
    3. Правим файл: /opt/etc/lighttpd/lighttpd.conf
    Code:
    # lighttpd configuration file
    server.modules              = (
                                    "mod_access",
                                    "mod_cgi",
                                    "mod_fastcgi",
                                    "mod_accesslog" )
    server.document-root        = "/opt/share/www/"
    connection.kbytes-per-second = 320
    index-file.names            = ( "index.php", "index.html")
    mimetype.assign             = (
      ".pdf"          =>      "application/pdf",
      ".sig"          =>      "application/pgp-signature",
      ".spl"          =>      "application/futuresplash",
      ".class"        =>      "application/octet-stream",
      ".ps"           =>      "application/postscript",
      ".torrent"      =>      "application/x-bittorrent",
      ".dvi"          =>      "application/x-dvi",
      ".gz"           =>      "application/x-gzip",
      ".pac"          =>      "application/x-ns-proxy-autoconfig",
      ".swf"          =>      "application/x-shockwave-flash",
      ".tar.gz"       =>      "application/x-tgz",
      ".tgz"          =>      "application/x-tgz",
      ".tar"          =>      "application/x-tar",
      ".zip"          =>      "application/zip",
      ".mp3"          =>      "audio/mpeg",
      ".m3u"          =>      "audio/x-mpegurl",
      ".wma"          =>      "audio/x-ms-wma",
      ".wax"          =>      "audio/x-ms-wax",
      ".ogg"          =>      "application/ogg",
      ".wav"          =>      "audio/x-wav",
      ".gif"          =>      "image/gif",
      ".jpg"          =>      "image/jpeg",
      ".jpeg"         =>      "image/jpeg",
      ".png"          =>      "image/png",
      ".xbm"          =>      "image/x-xbitmap",
      ".xpm"          =>      "image/x-xpixmap",
      ".xwd"          =>      "image/x-xwindowdump",
      ".css"          =>      "text/css",
      ".html"         =>      "text/html",
      ".htm"          =>      "text/html",
      ".js"           =>      "text/javascript",
      ".asc"          =>      "text/plain",
      ".c"            =>      "text/plain",
      ".cpp"          =>      "text/plain",
      ".log"          =>      "text/plain",
      ".conf"         =>      "text/plain",
      ".text"         =>      "text/plain",
      ".txt"          =>      "text/plain",
      ".dtd"          =>      "text/xml",
      ".xml"          =>      "text/xml",
      ".mpeg"         =>      "video/mpeg",
      ".mpg"          =>      "video/mpeg",
      ".mov"          =>      "video/quicktime",
      ".qt"           =>      "video/quicktime",
      ".avi"          =>      "video/x-msvideo",
      ".asf"          =>      "video/x-ms-asf",
      ".asx"          =>      "video/x-ms-asf",
      ".wmv"          =>      "video/x-ms-wmv",
      ".bz2"          =>      "application/x-bzip",
      ".tbz"          =>      "application/x-bzip-compressed-tar",
      ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
     )
    accesslog.filename          = "/opt/var/log/lighttpd/access.log"
    accesslog.format = "%h %l %u %{date}t \"%r\" \"%{Referer}i\""
    url.access-deny             = ( "~", ".inc",".sqlite" )
    $HTTP["url"] =~ "\.pdf$" {
      server.range-requests = "disable"
    }
    static-file.exclude-extensions = ( ".fcgi", ".php", ".pl", ".py", ".rb" )
    server.port                = 8080
    server.pid-file            = "/var/run/lighttpd.pid"
    fastcgi.server = ( ".php" =>
    ( "localhost" =>
    (
     "min-procs" => 1,
     "max-procs" => 1,
     "max-load-per-proc" => 4,
     "socket" => "/tmp/php-fastcgi.socket",
     "bin-path" => "/opt/bin/php-fcgi"
    )
    )
    )
    4. В файле: /opt/etc/init.d/S45php
    Code:
    #!/bin/sh
    export PHP_FCGI_CHILDREN=1
    PORT=1026
    BIN=/opt/bin/php-fcgi
    case $1 in
    start)
    $BIN -b $PORT &
    ;;
    stop)
     kill Pidof phpM  ;;
     *)
      echo "usage: $0 (start|stop)"
       exit 1
    ;;
       esac
    5. В файле /opt/etc/init.d/S80lighttpd
    Code:
    #!/bin/sh
    prefix="/opt"
    PATH=${prefix}/bin:${prefix}/sbin:/sbin:/bin:/usr/sbin:/usr/bin
    NAME=lighttpd
    DAEMON=${prefix}/sbin/${NAME}
    DAEMON_OPTS="-f ${prefix}/etc/lighttpd/lighttpd.conf"
    
    test -x $DAEMON || exit 0
    
    if [ -z "$1" ] ; then
        case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
            S??*) rc="start" ;;
            K??*) rc="stop" ;;
            *) rc="usage" ;;
        esac
    else
        rc="$1"
    fi
    
    case "$rc" in
        start)
    	echo "Starting web server: $NAME"
    	$DAEMON $DAEMON_OPTS
            ;;
        stop)
            if [ -n "`pidof $NAME`" ]; then
                echo "Stopping web server: $NAME"
                killall $NAME 2> /dev/null
            fi
            ;;
        restart)
            "$0" stop
            sleep 1
            "$0" start
            ;;
        *)  
            echo "Usage: $0 (start|stop|restart|usage)"
            ;;
    esac
    
    exit 0
    6. В файле /opt/share/www/index.php
    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    7. Задаем разрешения:
    chmod +x /opt/etc/init.d/S45php
    chmod +x /opt/etc/init.d/S80lighttpd
    chmod 744 /opt/share/www/index.php

    8. Запускаем
    /opt/etc/init.d/S45php start
    /opt/etc/init.d/S80lighttpd start

    9. Проверяем работу:
    В процессах (ps) должно быть примерно так:
    Code:
      355 admin      4120 S   /opt/bin/php-fcgi -b 1026
      356 admin      4124 S   /opt/bin/php-fcgi -b 1026
      362 admin      1116 S   /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
      363 admin      4120 S   /opt/bin/php-fcgi
      364 admin      4124 S   /opt/bin/php-fcgi
    открываем информационную страничку php, которую мы написали в п.6:
    http:\\192.168.1.1:8080(или ваш адрес роутера)
    10.Все.
    UPD by vectorm: нет, не все.
    Со всеми последними версиями нужно ОБЯЗАТЕЛЬНО сделать это.
    Иначе не запустится.
    Last edited by vectorm; 29-11-2010 at 20:06. Reason: UPD

Similar Threads

  1. Настройка работы IPTV в сети провайдера
    By Anth0ny in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 133
    Last Post: 07-11-2013, 09:10
  2. Не вижу половины сайтов (mtu & dns)
    By CHERT in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 347
    Last Post: 24-10-2012, 10:05
  3. Problem mit installtion von Lighttpd
    By Grabber66 in forum German Discussion - Deutsch (DE)
    Replies: 11
    Last Post: 03-02-2011, 20:28
  4. Replies: 111
    Last Post: 08-11-2009, 13:00

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •