-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.conf
executable file
·51 lines (39 loc) · 1.37 KB
/
default.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
#env shold declare
env env_test;
http {
log_format main '[$time_local] [Status:$status] [RealIP:$http_x_forwarded_for] [ForwardIP:$proxy_add_x_forwarded_for] [LocalIP:$remote_addr] '
'[$remote_user] [$request] [RequestTime:$request_time] '
'[BodyBytes:$body_bytes_sent] [$http_referer] [$http_user_agent]';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
# 清除多余请求头
more_clear_headers 'Server';
include /usr/local/openresty/nginx/conf/mime.types;
default_type application/octet-stream;
lua_package_path "/etc/nginx/lua/?.lua;;";
server {
listen 80;
location / {
resolver local=on ipv6=off;
access_by_lua_block {
local H = require("helloworld")
local json = require "cjson"
ngx.header['Content-Type'] = 'application/json; charset=utf-8'
local value = H:hello_value()
local ret = {code=0, msg="success",data=value}
ngx.say(json.encode(ret))
}
}
}
}