Server configuration
The global section of conf/server.conf: ports, paths, HTTP/2 and runtime switches.
A minimal working config
[default]
httpport = 80,8080
httpsport = 443
ip6_listen_enable = 1
http2_enable = 1
global_http2_enable = 1
deamon_enable = 0
mainhost = www.example.com
certificate_chain_file = www.example.com.pem
private_key_file = www.example.com.key
tmp_dh_file = dh4096.pem
chain_crt_file = www.example.com.crt
wwwpath = ./www/default
index = index.html
directorylist = 1
usehtmlcache = 1
usehtmlcachetime = 3600
session_type = 1
rate_limit_status = 0
acme_auto = 0
ocsp_intv_time = 14400Key settings
| Key | Default | Meaning |
|---|---|---|
httpport | 80 | Comma-separated port list supported |
httpsport | 443 | Same |
http2_enable | 1 | HTTP/2 and ALPN switch |
global_http2_enable | unset | Controls whether virtual sites inherit HTTP/2 |
cothreadnum | 6 | Coroutine worker threads |
ioc_thread_num | 8 | Max ORM / HTTP io_context count |
orm_thread_pool_num | 4 | ORM pool; 0 uses CPU count |
wwwpath | ./www/default | Static site root |
index | index.html | Default index file |
session_type | 1 | 0 file / 1 memory / 2 Redis / 3 Memcache |
rate_limit_status | 0 | Global rate-limit switch |
usehtmlcache | 1 | Static-file cache; TTL floor 10 seconds |
deamon_enable | 0 | Daemon mode |
ocsp_intv_time | 14400 | OCSP refresh ticks; multiplied by 5 seconds at runtime |
Ports and static roots
httpport and httpsport are parsed as comma-separated lists and fall back to 80 / 443 when empty. The static root comes from wwwpath, the default file from index, and directorylist = 1 enables directory listing.
lsof -i :80
sudo ss -tlnp | grep 80
# change conf/server.conf when the port is busy:
# httpport = 8080HTTP/2 inheritance
The default site is controlled by http2_enable. Virtual sites inherit isallnothttp2, which is then unconditionally overwritten by global_http2_enable. The shipped config only sets http2_enable = 1, so virtual sites without their own http2_enable = 1 default to HTTP/2 off.
Unused config keys
These keys remain in the config file but have no reader in the current C++ code: threadmax, threadmin, bmcport, staticfile_cache_num, modelspath, viewpath, controlpath, libspath and pluginspath. Keeping them is harmless; tuning them has no effect.
Start and stop
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j8
cd ..
lsof -i :80
./bin/paozhu conf/server.conf
curl -I http://127.0.0.1/
tail -f log/*