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.
Prerequisites
Section titled “Prerequisites”Install the required build dependencies.
AlmaLinux / Rocky Linux 9
Section titled “AlmaLinux / Rocky Linux 9”dnf groupinstall "Development Tools"dnf install gcc gcc-c++ cmake pcre-devel openssl-devel expat-devel zlib-develUbuntu / Debian
Section titled “Ubuntu / Debian”apt updateapt install build-essential gcc g++ cmake libpcre3-dev libssl-dev libexpat1-dev zlib1g-dev gitDownload and Build
Section titled “Download and Build”git clone https://github.com/litespeedtech/openlitespeed.gitcd openlitespeedbash build.shThe build.sh script handles cmake configuration and compilation. It builds the server binary and all bundled modules.
Install
Section titled “Install”After a successful build, install the server:
cd distbash install.shThis installs OLS to /usr/local/lsws/ with the same layout as a package install.
Build Options
Section titled “Build Options”The build.sh script accepts several environment variables:
# Build with debug symbolsXTRABUILDFLAGS="-g -O0" bash build.sh
# Specify a custom OpenSSL pathCFLAGS="-I/opt/openssl/include" LDFLAGS="-L/opt/openssl/lib" bash build.shFor more control, run cmake directly:
mkdir build && cd buildcmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/local/lswsmake -j$(nproc)Applying LiteHTTPD Patches
Section titled “Applying LiteHTTPD Patches”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:
cd openlitespeedgit apply /path/to/patches/0001-lsiapi-phpconfig.patchgit apply /path/to/patches/0002-lsiapi-rewrite.patchbash build.shcd dist && bash install.shSee the LiteHTTPD directive reference for which directives require the custom OLS build versus stock OLS.
Post-Installation
Section titled “Post-Installation”After building and installing, follow the same post-install steps as a repository install:
# 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.
Next Steps
Section titled “Next Steps”- Install from Repository — if you prefer pre-built packages.
- Upgrade and Downgrade — manage future version updates.
- Basic Configuration — configure the server.