-
Notifications
You must be signed in to change notification settings - Fork 178
/
nginx.conf
executable file
·58 lines (49 loc) · 1.54 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
54
55
56
57
58
worker_processes 1;
events {
worker_connections 102400;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 1024m;
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()
}
keepalive 32;
}
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 'https://servers';
access_by_lua_block{
local access = require "access"
access.dispatch()
}
proxy_set_header Host $newhost;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass $upstream;
}
error_log logs/error.log;
}
#将源码中的 manage.conf 路径
include /usr/local/openresty/nginx/proxygateway/manage.conf;
}