12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- pid /tmp/nginx.pid;
- error_log stderr error;
- events {
- worker_connections 16384;
- }
- http {
- resolver 127.0.0.1;
- access_log off;
- mruby_init_worker_code 'Userdata.new("my_#{Process.pid}").db = MySQL::Database.new("DBHOSTNAME", "benchmarkdbuser", "benchmarkdbpass", "hello_world")';
- mruby_exit_worker_code 'db = Userdata.new("my_#{Process.pid}").db ; db.close if db';
- server {
- listen 8080;
- server_name localhost;
- location / {
- root html;
- index index.html index.htm;
- }
- location /plaintext {
- default_type "text/plain";
- mruby_content_handler_code 'Nginx.rputs "Hello, world!"';
- }
- location /json {
- default_type "application/json";
- mruby_content_handler_code 'Nginx.rputs JSON::stringify("message" => "Hello, World!")';
- }
- location ~ /db {
- default_type "application/json";
- #note: next line has cwd
- mruby_content_handler 'CWD/db.rb' cache;
- }
- location ~ /queries {
- default_type "application/json";
- #note: next line has cwd
- mruby_content_handler 'CWD/queries.rb' cache;
- }
- # location ~ /fortunes {
- # default_type "application/html";
- # #note: next line has cwd
- # mruby_content_handler 'CWD/fortunes.rb' cache;
- # }
- #location ~ \.rb$ {
- # default_type "application/json";
- # mruby_add_handler on;
- #}
- #error_page 404 /404.html;
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- # proxy the PHP scripts to Apache listening on 127.0.0.1:80
- #
- #location ~ \.php$ {
- # proxy_pass http://127.0.0.1;
- #}
- }
- }
|