git clone https://github.com/GeneralSandman/TinyWeb
cd TinyWeb/src
mkdir build
cd build
cmake ../ && make
sudo cp TinyWeb.conf /
vim /TinyWeb.conf
jsonformate- Two parts in Configure-file:
developfor debugproductfor product environment
{
"develop": {
"basic": {
"worker": 2,
"pid": "/var/run/TinyWeb.pid",
"sendfile": true,
"mimetype": "mime.types",
"chunked": true,
"gzip": true,
"gzip_level" : 2,
"gzip_buffers_4k" : 16,
"gzip_min_len": 1024,
"gzip_http_version": ["1.0", "1.1"],
"gzip_mime_type": ["text/html", "text/css"]
},
"fcgi": {
"enable": true,
"connect_timeout": 300,
"send_timeout": 300,
"read_timeout": 300,
"keep_connect": true
},
"cache": [
{
"name": "cache_test",
"server_address": "127.0.0.1:7979",
"path": "/home/dell/TinyWeb/cache_files",
"space_max_size": "4194304",
"expires": "3600"
},
{
"name": "cache_test2",
"server_address": "127.0.0.1:7973",
"path": "/home/dell/TinyWeb/cache_files",
"space_max_size": "4194304",
"expires": "3600"
}
],
"server": [
{
"listen": 9090,
"servername": [
"127.0.0.1",
"dissigil.cn"
],
"www": "/home/dell/TinyWeb/www",
"indexpage": [
"index.html",
"index.htm",
"index.php"
],
"errorpage": [
{
"code" : [404],
"path" : "/home/dell/TinyWeb/www",
"file" : "404.html"
},
{
"code" : [500,502,503,504],
"path" : "/home/dell/TinyWeb/www",
"file" : "50x.html"
}
],
"fcgi": [
{
"pattern": "*.php",
"path" : "/home/dell/TinyWeb/www/test",
"indexpage": ["index.php", "index2.php"],
"listen": "127.0.0.1:9090"
},
{
"pattern": "*.cgi",
"path" : "/home/dell/TinyWeb/www/test",
"indexpage": ["index.php", "index2.php"],
"indexpage": ["index.cgi", "index2.cgi"],
"listen": "127.0.0.1:9091"
}
],
"cache": "cache_test"
}
],
"log": {
"level": "Debug",
"path": "/home/dell/TinyWeb/log",
"debugfile": "debug.log",
"infofile": "info.log",
"warnfile": "warn.log",
"errorfile": "error.log",
"fatalfile": "fatal.log"
}
}
}
name
meaning
type
basic
worker
worker number
int
pid
file record master's pid
string
sendfile
turn on/off sendfile
bool
mimetype
mimetype file
string
chunked
turn on/off chunked
bool
gzip
turn on/off gzip
bool
gzip_level
compress level
int
gzip_buffers_4k
buffer number for compress
int
gzip_min_len
compress body if longer this value
int
gzip_http_version
apply gzip configure if http-version match
string list
gzip_mime_type
compress file which has those mime-type
string list
fcgi
enable
turn on/off
bool
connect_timeout
connect timeout
int
send_timeout
send timeout
int
read_timeout
read timeout
int
keep_connect
keep connect
bool
cache (type cache-struct list)
name
cache name
string
server_address
source server address
string
path
path of stroe cache file
string
space_max_size
max size of cache(kB)
int
expires
expires time (second)
int
server (type is list)
listen
list port
int
servername
server host name
string list
www
website path
string
indexpage
default index page for url is path
string list
errorpage
default error page
errorpage-struct list
fcgi
fcgi config
fcgi-struct list
cache
cache name in cache struct
name
log
level
log level
string of Debug/Info/Warn/Error/Fatal
path
log path
string
debugfile
debug-log file
string
infofile
info-log file
string
warnfile
warn-log file
string
errorfile
error-log file
string
fatalfile
fatal-log file
string
| name | meaning | type |
|---|---|---|
| code | http status code | int list |
| path | error page path | string |
| file | error page file | string |
| name | meaning | type |
|---|---|---|
| indexpage | index page | string list |
| pattern | fcgi pattern | string |
| path | fcgi file path | string |
| listen | fcgi server address | string |
- Start server with default file
/TinyWeb.conf. Return error and exit if config-file doesn't exits.
sudo ./TinyWeb
- Get master's pid.
cat <pid-file>
- A configure file will be appointed when using
-c <config-file>.
sudo ./TinyWeb -c <config-file>
- Start server with Debug level and ignore the level of configure file.(Server is under terminal's control because it's not a daemon.)
sudo ./TinyWeb -d -c <config-file>
- Stop server safely.
sudo ./TinyWeb -o stop
cat <pid-file>
sudo kill -s SIGQUIT <master-pid>
- Stop server immeditely.
sudo ./TinyWeb -o stop
cat <pid-file>
sudo kill -s SIGTERM <master-pid>
sudo kill -s SIGINT <master-pid>
- Restart server.
sudo ./TinyWeb -o restart
cat <pid-file>
sudo kill -s SIGUSR1 <master-pid>
- Reload server with new configure file.
sudo ./TinyWeb -o reload [-c <config-file>]
cat /var/run/TinyWeb.pid
sudo kill -s SIGUSR2 <master-pid>
- Test configure file is vliad or not.
sudo ./TinyWeb --tcf /path/path/configfile
- Get TinyWeb version.
sudo ./TinyWeb -v
| Version | Improvements |
|---|---|