- Use Boost Beast Advanced server, flex (plain + SSL) as template for handling web operations.
- Currently developed on Debian Linux platform
sample configuration file (www.cfg)
thread_count = 2
port_http = 80
port_https = 443
listen_address = 0.0.0.0
content_directory = web/content
static_host = static.example.com
static_directory = web/static
static_extension = jpg
static_extension = jpeg
static_extension = png
static_extension = css
static_extension = txt
static_extension = ico
static_extension = gif
certificate_path_fullchain = certs/fullchain.pem
certificate_path_privkey = certs/privkey.pem
- compile environment: C++20
- requires libssl-dev, libboost-dev (json, log, program_options, serialization, url)
- add luajit and sol2
# acquire, build & install luajit
git clone --depth=1 https://github.com/LuaJIT/LuaJIT.git
pushd LuaJIT
sed -i 's/#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT/XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT/' src/Makefile
make
sudo make install
popd
# acquire & install sol2 (lua helpers for c++)
git clone --depth=1 https://github.com/ThePhD/sol2.git
sudo mv -n sol2/include/sol /usr/local/include/
mkdir build
cd build
cmake ..
make
To run on a port under 1024, requires something like:
sudo setcap CAP_NET_BIND_SERVICE=+eip ~/projects/web.boost/build/src/boost.web
~/projects/web.boost/build/src/boost.web
- 2026/08/09
- use sol2/luajit to load and run lua files
- integrates lua based html generator by riki moe (りき萌)
- 2026/08/02
- GET static html and support files from a directory
- supports HTTP and HTTPS
- influenced by riki's demo code
- copy src/lua/html.lua to web/lib
- create test.lua in web/content
package.path="web/lib/?.lua" local h = require( 'html' ) local output = h.Document{ lang = "en", h.head{ h.meta{charset = "UTF-8"}, h.title{"Hello, world!"}, }, h.body{ h.h1{"Hello, world!"}, h.p{ "This is an example of the little HTML templating framework." }, h.p{ "As you can see, it is fully capable of generating any kind of markup ", "you'd ever want.", h.br(), "It can even do things like ", h.b"bold text", "!" }, h.p"This is some embedded HTML <p></p>" } } Render( 'text/html', tostring( output ) )
- wt web toolkit - designed for single page applications with total control over page generation - not recommeded for internet centric applications - no lua
- drogon web framework - excellent functionality but comes up short on SSL capability and reliability - proprietary web template, no lua
- openresty - Web Platform Based on Nginx and LuaJIT - may come back to this