Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created September 28, 2012 08:46
Show Gist options
  • Select an option

  • Save jugyo/3798703 to your computer and use it in GitHub Desktop.

Select an option

Save jugyo/3798703 to your computer and use it in GitHub Desktop.
ngx_mruby を試す

ngx_mruby を試す

https://github.com/matsumoto-r/ngx_mruby

mruby のインストール

$ cd /usr/local/src
$ git clone https://github.com/mruby/mruby.git
$ cd mruby
$ make

ngx_mruby をダウンロード

$ cd /usr/local/src
$ git clone https://github.com/matsumoto-r/ngx_mruby.git

nginx のコンパイル

$ brew edit nginx

add --add-module=/usr/local/src/ngx_mruby as a configure option

$ brew install nginx

mruby スクリプトを用意

/var/www/hello.mrb:

Nginx.rputs(Time.now.to_s + " hello mruby world for nginx.")

nginx.conf に設定を追加

location /mruby {
    mrubyHandler /var/www/hello.mrb;
}

確認

nginx を起動し、 http://localhost/mruby にアクセス。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment