Skip to content

Build from Source

Building from source is useful when you need custom compile-time flags, want to apply patches (such as the LiteHTTPD LSIAPI patches), or are targeting a non-standard platform.

Install the required build dependencies.

Terminal window
dnf groupinstall "Development Tools"
dnf install gcc gcc-c++ cmake pcre-devel openssl-devel expat-devel zlib-devel
Terminal window
apt update
apt install build-essential gcc g++ cmake libpcre3-dev libssl-dev libexpat1-dev zlib1g-dev git
Terminal window
git clone https://github.com/litespeedtech/openlitespeed.git
cd openlitespeed
bash build.sh

The build.sh script handles cmake configuration and compilation. It builds the server binary and all bundled modules.

After a successful build, install the server:

Terminal window
cd dist
bash install.sh

This installs OLS to /usr/local/lsws/ with the same layout as a package install.

The build.sh script accepts several environment variables:

Terminal window
# Build with debug symbols
XTRABUILDFLAGS="-g -O0" bash build.sh
# Specify a custom OpenSSL path
CFLAGS="-I/opt/openssl/include" LDFLAGS="-L/opt/openssl/lib" bash build.sh

For more control, run cmake directly:

Terminal window
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/lsws
make -j$(nproc)

If you are using the LiteHTTPD module (ols_htaccess.so) with features that require custom OLS support (PHPConfig passthrough, LSIAPI Rewrite), apply the patches before building:

Terminal window
cd openlitespeed
git apply /path/to/patches/0001-lsiapi-phpconfig.patch
git apply /path/to/patches/0002-lsiapi-rewrite.patch
bash build.sh
cd dist && bash install.sh

See the LiteHTTPD directive reference for which directives require the custom OLS build versus stock OLS.

After building and installing, follow the same post-install steps as a repository install:

Terminal window
# Set admin password
/usr/local/lsws/admin/misc/admpass.sh
# Start the server
/usr/local/lsws/bin/lswsctrl start
# Enable on boot (create systemd unit if needed)

The WebAdmin GUI is available at https://your-server-ip:7080.