Cross-compile thttpd-2.29 to make duo an HTTP server.

0. Introduction

In embedded systems, lightweight HTTP servers are often preferred. Currently, there are several main web servers, including boa, thttpd, mini_httpd, shttpd, lighttpd, goaheand, appweb, and apache, among others.

Boa is relatively easy to compile, and you can find cross-compilation information online. I have verified that it works without issues.

1. Source Code Retrieval


thttpd Official Website (

Extract the files using the following command:

tar zxvf thttpd-2.29.tar.gz

Navigate to the source code directory:

cd thttpd-2.29

2. Cross-Compilation

The compilation process is relatively simple and involves setting up the cross-compilation toolchain, generating compile configurations, modifying the makefile, and running the make command.

a. Generate compile configurations by executing the following command in the source code directory:

./configure CC=riscv64-unknown-linux-musl-gcc --host=riscv64-unknown-linux --prefix=$(pwd)/install_cv1800b


b. Modify the Makefile, cgi-src/Makefile, and extras/Makefile in the source code directory. Mainly, change the CC compiler name and compilation parameters as shown in the image below:


After making these changes, execute the make command to complete the compilation.


This time, we won’t execute make install because it requires modifying ownership and permissions, which may fail unless you use sudo in the preceding steps. In the source code directory, you can find the thttpd program generated.


3. Installation

Copy the generated thttpd to /usr/bin on the Duo board and give it the necessary permissions by executing chmod 777 thttpd.

4. Configuration and Execution

Copy the index.html file from the source code to the /var/www directory on the board and give it the necessary permissions using chmod 644 index.html.


In the /var/www directory on the Duo board:


Next, create a configuration file in /etc:

touch thttpd.conf

vi thttpd.conf

Paste the following content:

# This section overrides defaults




# default = nobody



# This section _documents_ defaults in effect

# port=80

# nosymlink# default = !chroot

# novhost

# nocgipat

# nothrottles

# host=

# charset=iso-8859-1

After pasting, press Esc, then type :wq to save and exit.

Run the HTTP server:

thttpd -C /etc/thttpd.conf

The HTTP service is now running on the Duo.

You can open a web browser on your PC and visit to experience the HTTP service.


If you want to make thttpd start automatically at boot, you can add the command to /etc/profile, an init.d script like S99, or use other Linux methods for auto-starting services.

For further configuration, please refer to the thttpd configuration documentation or search the web. Thttpd supports CGI and PHP, so you have plenty of room for further applications.

Common use cases include OTA servers for smart homes

and personal blogs.

4. Software Retrieval

For your convenience, the cross-compiled programs have been uploaded to GitHub. You can access them directly.

GitHub Repository