Setting Up a Local PaaS Environment: Lighttpd, PHP, and Configuration on Linux

This guide walks through installing and configuring Lighttpd and PHP on a Linux machine for a Baidu PaaS platform, covering directory structure, whitelist setup, host file editing, service start/stop commands, and the relationship between app.conf and bae_app_conf.lua.

Baidu Intelligent Testing
Baidu Intelligent Testing
Baidu Intelligent Testing
Setting Up a Local PaaS Environment: Lighttpd, PHP, and Configuration on Linux

This article continues a series on building a PaaS platform environment by describing how to set up a local Linux instance for running applications, using the domain phpoffline.duapp.com as an example.

It outlines the required directory layout under /home/bae, including /home/bae/bae for PHP, /home/bae/lighttpd for Lighttpd, and /home/bae/wwwdata/htdocs as the Lighttpd document root, with a sub‑directory named after the chosen domain.

To enable Lighttpd, the guide downloads a pre‑packed tarball, extracts it to the appropriate directory, and then edits the whitelist file /home/bae/lighttpd/conf/domain_whitelist to add the domain, followed by editing /home/bae/lighttpd/conf/lighttpd.conf to set runtime paths:

var.rundir = "/home/bae/lighttpd"
var.wwwdir = "/home/bae/wwwdata/htdocs"
var.netpath = "10.40.72.110:9898/log"

It also adds a Lua‑based host rewrite rule:

$HTTP["host"] =~ "^(.*)$" {
    vhost-magnet.path-pattern = var.wwwdir + "/%_"
    vhost-magnet.attract-raw-url-to = ("/bae_app_conf.lua")
}

The /etc/hosts file is updated to map the chosen domain to the machine’s IP address, and a symbolic link is created under /home/bae/wwwdata/htdocs pointing to the application directory.

For PHP deployment, the article downloads another tarball, places its three directories under /home/bae/bae, and verifies configuration files such as /home/bae/bae/php/etc/php-fpm.conf and the executable /home/bae/bae/php/sbin/php-fpm. It then edits /home/bae/bae/phplib/php.ini to adjust open_basedir and error_log paths.

Service control commands are provided:

[bae@...]# /home/bae/bae/php/sbin/php-fpm start   # start PHP
[bae@...]# /home/bae/lighttpd/bin/lighttpd_control start   # start Lighttpd

Application deployment is performed by checking out the desired code version from SVN into /home/bae/wwwdata/htdocs/phpoffline.duapp.com and creating a symbolic link from the domain to the application directory.

Finally, the relationship between app.conf and bae_app_conf.lua is explained: app.conf is used when uploading code, while bae_app_conf.lua is used by Lighttpd for request forwarding. A reference link to Baidu’s documentation is provided for further details.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DeploymentConfigurationLinuxPHPPaaSLighttpd
Baidu Intelligent Testing
Written by

Baidu Intelligent Testing

Welcome to follow.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.