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();
?>
Read The Fucking Source Code