menial 2

Always at your service!



Help

Content

Configuration

Basic

menial 2 can be configured by providing a config file on startup or by using command line arguments. The following example shows a config file for menial 2, which contains all directives.

The content is YAML formated and has the following structure:

            
loglevel: info
hosts:
  localhost:80:
    root: /usr/share/menial/html/
    resources: /usr/share/menial/default/pages
ssl:
  4433:
    key: key.pem
    cert: cert.pem

            
        

Directives

You can add a lot of hosts to the config. If you do so, you need to configure each hosts handler and root directory. The other configuration directives (loglevel, logfilepath and logger) are considered as global. Some directives (such as staticdir) can be declared global and orverwritten for certain hosts.

A more sophisticated example:

{
    "hosts": {
        "*:80": {
            "handler": "redirect",
            "target": "myhomepage.tld:443",
            "keeptarget": true
        },
        "*:443": {
            "handler": "file",
            "root": "/var/www/html/myhomepage/"
        }
        "myfriend:80": {
            "handler": "file",
            "root": "/var/www/html/myfriendshomepage/"
        },
        "myfriendscousin:80": {
            "handler": "file",
            "root": "/var/www/html/myfriendscousinshomepage/"
            "staticdir": "/home/myfriendscousin/menial/static/",
            "additionalheaders": "Access-Control-Allow-Origin: *\n"
        },
        "*:8000": {
            "handler": "python",
            "root": "wsgi:application",
            "staticdir": "/can/be/blank/because/python/must/handle/errors/"
        }
    },
    "logger": "file",
    "loglevel": "info",
    "iplogging": true,
    "logfilepath": "/var/log/menial/",
    "staticdir": "/etc/menial/static/",
    "resources": "/etc/menial/resources/",
    "ssl": {
        "443": {
            "on": true,
            "cert": "/path/to/the/cert.pem",
            "key": "/path/to/the/key.pem"
        }
    }
}
        

Custom config

When you run menial you need to pass the location to the config file as first parameter.
You can create your own config file (e.g. copying the exsting one) and save it at any accessible locatation. Handover the new file to menial on startup.