# H2O

the optimized HTTP/1.x, HTTP/2 server

×
Powered by Oktavia

## Configure > Mruby Directives

The following are the configuration directives of the mruby handler. Please refer to Using mruby to find out how to write handlers using mruby.

### `"mruby.handler"`

Description:

  Upon start-up evaluates given mruby expression, and uses the returned mruby object to handle the incoming requests.

  Example. Hello-world in mruby

      mruby.handler: |
        Proc.new do |env|
          [200, {'content-type' => 'text/plain'}, ["Hello world\n"]]
        end

  Note that the provided expression is evaluated more than once (typically for every thread that accepts incoming connections).

Level:
  path
See also:
  `mruby.handler-file`

### `"mruby.handler-file"`

Description:

  Upon start-up evaluates given mruby file, and uses the returned mruby object to handle the incoming requests.

  Example. Hello-world in mruby

      mruby.handler-file: /path/to/my-mruby-handler.rb

  Note that the provided expression is evaluated more than once (typically for every thread that accepts incoming connections).

Level:
  path
See also:
  `mruby.handler`