forked from danday74/docker-nginx-lua
-
Notifications
You must be signed in to change notification settings - Fork 14
/
nginx.conf
109 lines (79 loc) · 2.97 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#user nobody;
worker_processes 2;
#error_log logs/error.log;
error_log logs/error.log debug;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
access_log logs/access_http.log;
error_log logs/error_http.log;
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
#we dont want to send a static files so we can commnet it (optimization)
#sendfile on;
#tcp_nopush on;
# don't buffer data-sends (disable Nagle algorithm). Good for sending frequent small bursts of data in real time.
#tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#path set in docker file, each lua library is copied to lua-libs folder
lua_package_path "/usr/local/lib/lua-libs/?.lua;;";
#lua_package_path "/opt/lua-resty-redis/lib/?.lua;;";
# Required to announce the dead backends
lua_shared_dict deads 10m;
#proxy_set_header Host $http_host;
#proxy_set_header X-Forwarded-Port $server_port;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_set_header X-Forwarded-Protocol $scheme;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_read_timeout 30;
#proxy_connect_timeout 10;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 so_keepalive=on;
server_name localhost;
client_max_body_size 20M;
tcp_nodelay on;
proxy_connect_timeout 8h;
proxy_send_timeout 8h;
proxy_read_timeout 8h;
location / {
resolver 127.0.0.1;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
include nginx-lua.conf;
}
location /hellolua {
content_by_lua '
ngx.header["Content-Type"] = "text/plain";
ngx.say("hello world");
';
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}