forked from ffay/proxygateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
executable file
·53 lines (44 loc) · 1.32 KB
/
nginx.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
51
52
53
worker_processes 2;
events {
worker_connections 102400;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
lua_shared_dict cache 10m;
#换成你的实际路径,这里将源码中src目录加入到 lua_package_path
lua_package_path '/usr/local/openresty/nginx/proxygateway/src/?.lua;;';
#lua_code_cache off;
upstream servers {
server 127.0.0.1;
balancer_by_lua_block{
local balancer = require "balancer"
balancer.balancing()
}
}
init_worker_by_lua_block{
require "init"
}
server {
listen 80 default_server;
server_name localhost;
location / {
set $backend_host '127.0.0.1';
set $backend_port 80;
set $newhost '';
set $upstream 'http://servers';
access_by_lua_block{
local access = require "access"
access.dispatch()
}
proxy_set_header Host $newhost;
proxy_http_version 1.1;
proxy_pass $upstream;
}
error_log logs/error.log;
}
#将源码中的 manage.conf 路径
include /usr/local/openresty/nginx/proxygateway/manage.conf;
}