| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- worker_cpu_affinity auto;
- pid /tmp/nginx.pid;
- error_log stderr error;
- worker_rlimit_nofile 102400;
- timer_resolution 1000ms;
- daemon off;
- events {
- worker_connections 100000;
- }
- http {
- resolver 127.0.0.1;
- access_log off;
- server_tokens off;
- msie_padding off;
- sendfile off; #default
- tcp_nopush off; #default
- tcp_nodelay on; #default
- keepalive_timeout 65;
- keepalive_disable none;
- keepalive_requests 100000;
- lua_package_path '/openresty/?.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 backlog=65535 reuseport;
- 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()
- }
- }
- }
- }
|