123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- pid /tmp/nginx.pid;
- error_log stderr error;
- events {
- worker_connections 16384;
- }
- http {
- resolver 127.0.0.1;
- access_log off;
- lua_package_path 'CWD/?.lua;;';
- init_by_lua_block {
- jit.opt.start("minstitch=10")
- require "resty.core"
- encode = require("cjson").encode
- mysql = require("resty.mysql")
- app = require("app")
- }
- server {
- listen 8080;
- location /plaintext {
- default_type "text/plain";
- content_by_lua_block {
- ngx.print("Hello, world!")
- }
- }
- location /json {
- default_type "application/json";
- content_by_lua_block {
- ngx.print(encode({message = "Hello, World!"}))
- }
- }
- location /fortunes {
- default_type "text/html; charset=UTF-8";
- content_by_lua_block {
- app.fortunes()
- }
- }
- location /db {
- default_type "application/json";
- content_by_lua_block {
- app.db()
- }
- }
- location / {
- default_type "application/json";
- content_by_lua_block {
- app.queries()
- }
- }
- }
- }
|