GitHub - GeneralSandman/TinyWeb: A high-performance web server in C++11.

High-Performance Web Server which is based on C++11.

git clone https://github.com/GeneralSandman/TinyWeb
cd TinyWeb/src
mkdir build
cd build
cmake ../ && make
sudo cp TinyWeb.conf /
vim /TinyWeb.conf
{
    "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"
        }
    }
}

sudo ./TinyWeb -c <config-file>
sudo ./TinyWeb -d -c <config-file>
sudo ./TinyWeb -o stop

cat <pid-file>
sudo kill -s SIGQUIT <master-pid> 
sudo ./TinyWeb -o stop

cat <pid-file>
sudo kill -s SIGTERM <master-pid> 
sudo kill -s SIGINT <master-pid> 
sudo ./TinyWeb -o restart

cat <pid-file>
sudo kill -s SIGUSR1 <master-pid> 
sudo ./TinyWeb -o reload [-c <config-file>]

cat /var/run/TinyWeb.pid
sudo kill -s SIGUSR2 <master-pid> 
sudo ./TinyWeb --tcf /path/path/configfile