Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: Spike on August 01, 2026, 10:05:52 AM
-
Back in 2015 I built a Pi-based http server for a non-internet connected project using piCore and lighttpd.
I now need to update it to support SSL (https). I don't really mind whether I go to a new version of piCore, but on balance I might as well do so while I'm making changes.
I have two problems:
1. lighttpd no longer seems to be in the extensions repository. Is there a reason for this?
2. If I install lighttpd from an 11 year old repository, it seems to work, but as far as I can tell, that version (of lighttpd) doesn't support SSL.
Any thoughts as to where to go from here? I guess I could switch to Apache, but I preferred the idea of a lighter-weight http server.
-
How about nginx (https://nginx.org/) ?
-
I do have this build script sitting around. It expects to be run from the root of an extracted tarball of lighttpd. You will probably want to add extra flags to the ./configure call if you are needing a different ssl library. Also, since this was for tinycore x86_64, some of the libraries may be named differently.
(My main use for this was under x86_64, the lighttpd in the repos didn't have magnet support. I haven't tested the ssl support, since I already have it behind nginx)
tce-load -i compiletc autoconf automake libtool m4 pcre pcre-dev pkg-config libtool-dev
tce-load -i pcre21042-dev
tce-load -i lua-5.4-dev openssl-dev zstd-dev squashfs-tools sqlite3-dev libxml2-dev
if ! [ -e configure ]; then
libtoolize
./autogen.sh
fi
./configure --with-lua --with-zlib --with-zstd --with-bzip2 --with-openssl --with-sqlite --with-webdav-props --with-webdav-locks --libdir=/usr/local/lib/lighttpd
make -j 4
make DESTDIR=/home/tc/lighttpd/lighttpd-m install
cd /home/tc/lighttpd
mksquashfs lighttpd-m lighttpd-m.tcz
cat <<EOF >lighttpd-m.tcz.dep
openssl.tcz
pcre21042.tcz
lua-5.4-lib.tcz
sqlite3.tcz
libxml2.tcz
EOF
-
Thanks, both. I'll try building lighttpd using mjmouse's script. If I don't get on well with that (haven't compiled *anything* on *nix in the last 30 years, never mind a tcx :) ) I'll switch to nginx. Though everything I read says how well suited lighttpd is for embedded systems and RPi, so let's hope that works out.
-
Hi Spike
... mind a tcx :) ...
Building a .tcz file is easy.
Install squashfs-tools.tcz:
tce-load -wi squashfs-tools
Create the directory tree that will contain the programs files:
mkdir -p pkg/usr/local/sbin
mkdir -p pkg/usr/local/lib
... etc ...
Copy (or move) the compiled files (or directories) to their destination:
cp -a Path/To/lighttpd pkg/usr/local/sbin
... etc ...
Once all of the required files have been copied, create the .tcz file:
mksquashfs pkg lighttpd.tcz -noappend
-
So building a tcz turned out to be not scary at all ;)
I managed to build lighttpd from the latest sources, and produced .tcz, .tcz.dep etc. But when I try to load that onto a clean piCore 16.0, it says it's installed, but I'm not seeing a config file where I'd expect, i.e. /usr/local/etc/lighttpd/lighttpd.conf.
I'll continue poking around to see if I can see what I'm missing, but if anyone can point me in the right direction, I'd be grateful.
-
Hi Spike
... but I'm not seeing a config file where I'd expect, i.e. /usr/local/etc/lighttpd/lighttpd.conf. ...
When you executed this step:
... Create the directory tree that will contain the programs files:
mkdir -p pkg/usr/local/sbin
mkdir -p pkg/usr/local/lib
... etc ... ...
Did you also do this:
mkdir -p pkg/usr/local/etc/lighttpdand copy a lighttpd.conf to that directory?
If you run:
unsquashfs -ll lighttpd.tczdoes the listing it prints out include usr/local/etc/lighttpd/lighttpd.conf ?
-
It doesn't create a sample lighttpd.conf by default. I think that is more often a distro-provided thing.
It should be fine to just run sudo lighttpd -D -f /path/to/a/new/lighttpd.conf once you make a new lighttpd.conf. And then remove -D once you are happy for it to run in the background.
Example (trimmed) contents of my config for my site: (it runs under an added www-data user)
server.document-root = "/home/www-data/repo/public_html/"
server.port = 80
server.username = "www-data"
server.groupname = "www-data"
static-file.exclude-extensions = ( ".php", ".cgi", ".lua" )
index-file.names = ( "index.html", "index.lua" )
mimetype.assign = (
".css" => "text/css; charset=utf-8",
".html" => "text/html; charset=utf-8",
".js" => "text/javascript; charset=utf-8",
".lua" => "application/lua; charset=utf-8",
".png" => "image/png",
".txt" => "text/plain",
".webmanifest" => "application/manifest+json",
)
server.modules += ( "mod_cgi", "mod_status", "mod_access", "mod_accesslog", "mod_expire", "mod_redirect", "mod_setenv", "mod_magnet" )
magnet.attract-physical-path-to = ( "/home/www-data/repo/magnet.lua" )
magnet.attract-response-start-to = ( "/home/www-data/repo/magnet-response.lua" )
server.errorlog = "/tmp/lighttpd-error.log"
server.breakagelog = "/tmp/lighttpd-breakage.log"
accesslog.filename = "/tmp/lighttpd-access.log"
include_shell "echo var.lua = '\"'$(which lua)'\"'"
cgi.assign = ( ".lua" => var.lua )
cgi.execute-x-only = "enable"
cgi.limits = (
"write-timeout" => 60,
"read-timeout" => 180,
)
setenv.add-environment = (
"REALDB_ROOT" => "/home/www-data/databases",
)
$HTTP["url"] =~ "^/favicon.ico$" {
url.redirect = (
"^/favicon.ico$" => "/favicon.png"
)
url.redirect-code = 307
}
# various basically-static data
$HTTP["url"] =~ "^/scripts/" {
expire.url = ( "" => "access plus 30 days" )
}
$HTTP["url"] =~ "^/(main|clock)\.[0-9]+\.css$" {
expire.url = ( "" => "access plus 30 days" )
}
$HTTP["url"] =~ "^/favicon\.(png|ico)$" {
expire.url = ( "" => "access plus 30 days" )
}