lighttpd 1.4.53 Porting Guide (openEuler 20.03 LTS SP1)

randy15682021-12-29LighttpdPorting Guide



lighttpd is an excellent open source lightweight software, whose fundamental purpose is to provide a secure, fast, compatible, and flexible web server environment for high-performance websites. It has a low memory footprint, is loaded with a small CPU, and delivers good performance and abundant modules.

Programming language: C

Brief description: web server

lighttpd 1.4.53

Environmental Requirements


The following table lists the hardware requirements.

ServerTaiShan 200 server (model 2280)
CPUKunpeng 920 5250 processor
Drive partitionNo requirements

Operating Systems

The following table lists the requirements for the operating system.

openEuler20.03 SP1 AArch64

Note: When installing the OS for the first time, select "Server with GUI" instead of "Minimal Install". This will bypass the need to manually install lots of software packages.

Configuring the Compilation Environment

  1. Install dependencies.

yum -y install gcc gcc-c++ glib2-devel pcre-devel bzip2-devel zlib-devel gamin-devel

  1. Obtain the source code.


Preparing the Installation Package

cp lighttpd-1.4.53.tar.gz $HOME && cd $HOME
tar xzvf lighttpd-1.4.53.tar.gz

Compiling and Installing lighttpd

cd lighttpd-1.4.53
./configure  --prefix=/usr/local/lighttpd  --with-fam
make -j60 && make install


--prefix=PATH specifies the lighttpd installation directory.
--with-fam reduces the number of times that stat() is called.

Configuring Parameters

Creating a Software Directory

cd /usr/local/lighttpd/
mkdir log webpages cache config

Copying the Configuration File or Directory

cp $HOME/lighttpd-1.4.53/doc/config/lighttpd.conf  /usr/local/lighttpd/config/
cp $HOME/lighttpd-1.4.53/doc/config/modules.conf   /usr/local/lighttpd/config/
cp $HOME/lighttpd-1.4.53/doc/config/conf.d         /usr/local/lighttpd/config/ -r


When lighttpd is installed, only three folders lib, sbin, and share exist in the installation directory. Other files need to be copied and created.

Modifying the lighttpd.conf File

vi /usr/local/lighttpd/config/lighttpd.conf

Modify lines 16 to 20 as follows:

var.log_root       =   "/usr/local/lighttpd/log"
var.server_root    =   "/usr/local/lighttpd"
var.state_dir      =   "/usr/local/lighttpd"
var.home_dir       =   "/usr/local/lighttpd"
var.conf_dir       =   "/usr/local/lighttpd/config"

Modify line 61 as follows:

var.cache_dir      =   "/usr/local/lighttpd/cache"

Add the following comment to line 93:

#server.use-ipv6 = "enable"

Modify lines 104 to 105 as follows: (This item is about the operation permission. You are not advised to use the root user.)

server.username  =  "lighttpd1"
server.groupname  =  "lighttpd"

Modify line 115 (path for storing the access page) as follows:

server.document-root  =  server_root + "webpages"

Modify line 246 (cache mode) as follows: (The default value is simple. According to the official explanation, fam is better than simple.)

server.stat-cache-engine = "fam"

Add the following content to line 182. (This configuration item is used to configure the multi-process mode. The lighttpd process is a single process by default. You can change the value based on the site requirements.)

server.max-worker = 4

Creating a User Group

groupadd  lighttpd
useradd -g lighttpd  lighttpd1

Modifying Permissions

chown lighttpd1  /usr/local/lighttpd/log

Adding a Test Page

cd /usr/local/lighttpd/webpages vi index.html

	<title>lighttpd test</title>
	<p>this is a testing</p>

Testing the Service

Start lighttpd.

/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/config/lighttpd.conf

Check the program process.

ps -ef |grep lighttpd

Stop lighttpd.

pkill lighttpd

Test web page:


[Disclaimer] This article only represents the author's opinions, and is irrelevant to this website. This website is neutral in terms of the statements and opinions in this article, and does not provide any express or implied warranty of accuracy, reliability, or completeness of the contents contained therein. This article is for readers' reference only, and all legal responsibilities arising therefrom are borne by the reader himself.