mruby_nginx_module is the powerful extension by mruby for nginx.
The concept of mruby_nginx_module is following.
location /mruby {
mruby_content_handler_code "
sum = 0
(1..10).each { |i| sum += i }
Nginx.rputs(sum.to_s + "\n") #=> 55
";
}
Please see Documents.
Minumum Require
Optional
mruby+mruby_nginx_module
$ git clone https://github.com/cubicdaiya/mruby_nginx_module.git
$ cd mruby_nginx_module
$ git submodule update --init
$ cd mruby
$ # Optional commands if you want
$ rake ENABLE_GEMS="true" CFLAGS="-O2 -fPIC"
nginx+mruby_nginx_module
$ # download and unpack stable nginx version
$ cd nginx-1.4.1 # for eaxmple
$ ./configure -add-module=../mruby_nginx_module
$ make
$ sudo make install
mruby+mgem
$ gem install mgem
$ mgem update && mgem list
$ mgem add mruby-userdata # for example
$ mgem active mruby-userdata
$ mgem config # answer the question and then you should add this
$ # replcae build_config.rb with last text output or make changes by hand, then
$ rake ENABLE_GEMS="true" CFLAGS="-O2 -fPIC"
+nginx-echo-module+ngx_devel_kit
$ # download and unpack stable nginx version
$ cd nginx-1.4.1 # for eaxmple
$ ./configure --with-pcre-jit --add-module=../nginx-echo-module \
--add-module=../mruby_nginx_module --add-module=../ngx_devel_kit
$ make
$ sudo make install
$ cd mruby_nginx_module
rake NGINX_BIN=#{nginx_bin}
Pass all tests - echo-nginx-module is requierd.
Make sure where nginx
placed
Default NGINX_BIN is /usr/sbin/nginx.
Change it if diferent in mruby_nginx_module/test/test.rb
mruby_nginx_module is forked from ngx_mruby at July 2013.
Though I used to develop ngx_mruby with ngx_mruby's developers, what I want to develop were gradually departured from what they want to develop.
What I want to develop are as previously noted concepts.
ngx_mruby is a part of unified web server extension developing support institution(like mod_mruby).
But what I want to develop is the product that is more specialized for nginx.
In detail, mruby_nginx_modules has the following features currently.
Additionally I'm going to implement the following features.