ngx_ruby- 嵌入 ruby 脚本的 Nginx 模块
C/C++ Nginx扩展模块
访问GitHub主页
共0Star
详细介绍
ngx_ruby
ngx_ruby 是嵌入 ruby 脚本的 Nginx 模块。
环境
-
ruby-2.3.*
-
nginx-1.6.3+
安装
$ git clone https://github.com/rryqszq4/ngx_ruby.git
$ wget 'http://nginx.org/download/nginx-1.6.3.tar.gz'
$ tar -zxvf nginx-1.6.3.tar.gz
$ cd nginx-1.6.3
$ export RUBY_INC=/path/to/ruby/include/ruby-2.3.0
$ export RUBY_LIB=/path/to/ruby/lib
$ ./configure --user=www --group=www \
--prefix=/path/to/nginx \
--add-module=/path/to/ngx_ruby
$ make
$ make install
摘要
nginx config:
user www www;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /content_by_ruby {
content_by_ruby "
time1 = Time.new
Ngx.print('Hello, Ngx_ruby. Current Time : ' + time1.inspect);
";
}
location /content_by_ruby_file {
content_by_ruby_file /ngx_ruby/t/library/hello.rb;
}
}
}
推荐源码
-
0 Star
-
0 Star
-
0 Star
-
0 Star
-
0 Star
-
0 Star