lighttpd + php 移植配置

  • buildroot 内添加 lighttpd 和php 等相关选项

    // make menuconfig
    Target packages  --->
        Interpreter languages and scripting  --->
            [*] perl
            [*] php
            [*]   CGI interface
            [*]   FPM interface
                Extensions  --->
                    [*] Readline
                    [*] Session
                    [*] zlib
                    [*] JSON
                    [*] FTP
                    [*] sockets
                    [*] Posix
                    [*] libxml

    Networking applications  --->
        [*] lighttpd
        [*]   openssl support
        [*]   zlib support
        [*]   bzip2 support
        [*]   pcre support
        [*]   webdav support        
  • 进入生成的文件系统配置 lighttpd + php

    //  vim etc/lighttpd/lighttpd.conf
    var.log_root    = "/usr/share/lighttpd/log"            // log 日志存放点
    var.server_root = "/usr/share/lighttpd/www"
    var.state_dir   = "/usr/share/lighttpd/run"
    var.home_dir    = "/usr/share/lighttpd/lib/lighttpd"
    var.conf_dir    = "/etc/lighttpd"

    var.cache_dir   = "/usr/share/lighttpd/cache/lighttpd"

    var.socket_dir  = home_dir + "/sockets"       // /usr/share/lighttpd/lib/lighttpd/sockets

    server.use-ipv6 = "disable"
    
    server.document-root = server_root + "/webpages"

    server.event-handler = "linux-sysepoll"
    
    server.network-backend = "writev"
    
    server.upload-dirs = ( "/usr/share/lighttpd/upload" )
    //  vim etc/lighttpd/modules.conf
    server.modules = ( 
   "mod_access",
   "mod_alias",
    #  "mod_auth",
    #  "mod_authn_file",
    #  "mod_evasive",
    #  "mod_redirect",
    #  "mod_rewrite",
    #  "mod_setenv",
    #  "mod_usertrack",
    #  "mod_compress",
    )

    include "conf.d/compress.conf"
    
    include "conf.d/fastcgi.conf"
    // vim etc/lighttpd/conf.d/fastcgi.conf
    server.modules += ( "mod_fastcgi" )

    ##
    ## PHP Example
    ## For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.
    ##
    ## The number of php processes you will get can be easily calculated:
    ##
    ## num-procs = max-procs * ( 1 + PHP_FCGI_CHILDREN )
    ##
    ## for the php-num-procs example it means you will get 17*5 = 85 php
    ## processes. you always should need this high number for your very
    ## busy sites. And if you have a lot of RAM. :)
    ##
    fastcgi.server = ( 
                ".php" =>
                    ( "php-local" =>
                       (   
                    "socket" => socket_dir + "/php-fastcgi-1.socket",
                            "bin-path" => "/usr/bin/php-cgi",
                            "max-procs" => 1,
                    "broken-scriptfilename" => "enable",
                       )   
                    )   
                ) 
    // vim etc/lighttpd/conf.d/compress.conf 
    server.modules += ( "mod_compress" )

    ##
    ## where should the compressed files be cached?
    ## see the base config for the declaration of the variable.
    ##
    ## This directory should be changed per vhost otherwise you can
    ## run into trouble with overlapping filenames
    ##
    compress.cache-dir         = cache_dir + "/compress"

    ##
    ## FileTypes to compress.
    ## 
    compress.filetype          = ("text/plain", "text/html")
    // vim etc/php.ini
    cgi.fix_pathinfo=1
  • 创建相关目录

    mkdir -p /usr/share/lighttpd
    cd /usr/share/lighttpd
    mkdir  cache   lib     log     run     upload  www
    mkdir  -p  cache/lighttpd/
    mkdir  -p  lib/lighttpd/sockets/
    mkdir  -p  www/webpages
    touch  www/webpages/index.php
  • 给 usr/share/lighttpd/www/webpages/index.php 添加内容

   //    vim usr/share/lighttpd/www/webpages/index.php
   <?php
            echo phpinfo();
    ?>  

转载于:https://www.cnblogs.com/chenfulin5/p/7568901.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值