Web Server (lighttpd) - FrankBau/meta-marsboard-bsp GitHub Wiki
The goal is to install lighttpd with php support.
on the build host
Add two more layers to conf/bblayers.conf if not yet present:
add some packages to your image:
IMAGE_INSTALL_append += " lighttpd php"
build the image, install it on SD card and boot the target.
bringing up lighttpd
mv /etc/lighttpd.conf /etc/lighttpd.conf.orig
Edit /etc/lighttpd.conf
:
server.document-root = "/www/pages"
server.port = 80
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png"
)
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
and create a HTML web page /www/pages/index.html
After testing, check the original conf for more settings and consult the home page: https://www.lighttpd.net/
enabling PHP
The following rpm packages are needed: lighttpd-module-fastcgi
and php-cgi
. They were built when the image was bitbaked but not deployed to the target image. Locate these packages in the BSPDIR under build/deploy/rpm
, copy them to the target and install them on the target:
rpm --install php-cgi-5.6.23-r0.cortexa9hf_neon.rpm
rpm --install lighttpd-module-fastcgi-1.4.39-r0.cortexa9hf_neon.rpm
Besides the installed php package, you need to extend /etc/lighttpd.conf
to load the fastcgi module and use php-cli:
server.modules = (
"mod_fastcgi"
)
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi"
)
)
)
index-file.names = ( "index.php", "index.html" )
Create a minimal file /www/pages/index.php
and remove (rename) the previously created file /www/pages/index.html
.
The .php file should contain a single line:
<?php phpinfo(); ?>
Restart the web server to make your changes effective:
/etc/init.d/lighttpd restart