diff --git a/Dengine/tengine/CHANGES b/Dengine/tengine/CHANGES index 5b1242a..4d9e62a 100644 --- a/Dengine/tengine/CHANGES +++ b/Dengine/tengine/CHANGES @@ -1,66 +1,5 @@ -Changes with nginx 1.6.2 16 Sep 2014 - - *) Security: it was possible to reuse SSL sessions in unrelated contexts - if a shared SSL session cache or the same TLS session ticket key was - used for multiple "server" blocks (CVE-2014-3616). - Thanks to Antoine Delignat-Lavaud. - - *) Bugfix: requests might hang if resolver was used and a DNS server - returned a malformed response; the bug had appeared in 1.5.8. - - *) Bugfix: requests might hang if resolver was used and a timeout - occurred during a DNS request. - - -Changes with nginx 1.6.1 05 Aug 2014 - - *) Security: pipelined commands were not discarded after STARTTLS - command in SMTP proxy (CVE-2014-3556); the bug had appeared in 1.5.6. - Thanks to Chris Boulton. - - *) Bugfix: the $uri variable might contain garbage when returning errors - with code 400. - Thanks to Sergey Bobrov. - - *) Bugfix: in the "none" parameter in the "smtp_auth" directive; the bug - had appeared in 1.5.6. - Thanks to Svyatoslav Nikolsky. - - -Changes with nginx 1.6.0 24 Apr 2014 - - *) 1.6.x stable branch. - - -Changes with nginx 1.5.13 08 Apr 2014 - - *) Change: improved hash table handling; the default values of the - "variables_hash_max_size" and "types_hash_bucket_size" were changed - to 1024 and 64 respectively. - - *) Feature: the ngx_http_mp4_module now supports the "end" argument. - - *) Feature: byte ranges support in the ngx_http_mp4_module and while - saving responses to cache. - - *) Bugfix: alerts "ngx_slab_alloc() failed: no memory" no longer logged - when using shared memory in the "ssl_session_cache" directive and in - the ngx_http_limit_req_module. - - *) Bugfix: the "underscores_in_headers" directive did not allow - underscore as a first character of a header. - Thanks to Piotr Sikora. - - *) Bugfix: cache manager might hog CPU on exit in nginx/Windows. - - *) Bugfix: nginx/Windows terminated abnormally if the - "ssl_session_cache" directive was used with the "shared" parameter. - - *) Bugfix: in the ngx_http_spdy_module. - - -Changes with nginx 1.5.12 18 Mar 2014 +Changes with nginx 1.4.7 18 Mar 2014 *) Security: a heap memory buffer overflow might occur in a worker process while handling a specially crafted request by @@ -69,23 +8,11 @@ Changes with nginx 1.5.12 18 Mar 2014 Thanks to Lucas Molas, researcher at Programa STIC, Fundación Dr. Manuel Sadosky, Buenos Aires, Argentina. - *) Feature: the "proxy_protocol" parameters of the "listen" and - "real_ip_header" directives, the $proxy_protocol_addr variable. - *) Bugfix: in the "fastcgi_next_upstream" directive. Thanks to Lucas Molas. -Changes with nginx 1.5.11 04 Mar 2014 - - *) Security: memory corruption might occur in a worker process on 32-bit - platforms while handling a specially crafted request by - ngx_http_spdy_module, potentially resulting in arbitrary code - execution (CVE-2014-0088); the bug had appeared in 1.5.10. - Thanks to Lucas Molas, researcher at Programa STIC, Fundación Dr. - Manuel Sadosky, Buenos Aires, Argentina. - - *) Feature: the $ssl_session_reused variable. +Changes with nginx 1.4.6 04 Mar 2014 *) Bugfix: the "client_max_body_size" directive might not work when reading a request body using chunked transfer encoding; the bug had @@ -95,71 +22,15 @@ Changes with nginx 1.5.11 04 Mar 2014 *) Bugfix: a segmentation fault might occur in a worker process when proxying WebSocket connections. - *) Bugfix: a segmentation fault might occur in a worker process if the - ngx_http_spdy_module was used on 32-bit platforms; the bug had - appeared in 1.5.10. - *) Bugfix: the $upstream_status variable might contain wrong data if the - "proxy_cache_use_stale" or "proxy_cache_revalidate" directives were - used. - Thanks to Piotr Sikora. - - *) Bugfix: a segmentation fault might occur in a worker process if - errors with code 400 were redirected to a named location using the - "error_page" directive. - - *) Bugfix: nginx/Windows could not be built with Visual Studio 2013. - - -Changes with nginx 1.5.10 04 Feb 2014 - - *) Feature: the ngx_http_spdy_module now uses SPDY 3.1 protocol. - Thanks to Automattic and MaxCDN for sponsoring this work. - - *) Feature: the ngx_http_mp4_module now skips tracks too short for a - seek requested. - - *) Bugfix: a segmentation fault might occur in a worker process if the - $ssl_session_id variable was used in logs; the bug had appeared in - 1.5.9. - - *) Bugfix: the $date_local and $date_gmt variables used wrong format - outside of the ngx_http_ssi_filter_module. - - *) Bugfix: client connections might be immediately closed if deferred - accept was used; the bug had appeared in 1.3.15. - - *) Bugfix: alerts "getsockopt(TCP_FASTOPEN) ... failed" appeared in logs - during binary upgrade on Linux; the bug had appeared in 1.5.8. - Thanks to Piotr Sikora. - - -Changes with nginx 1.5.9 22 Jan 2014 - - *) Change: now nginx expects escaped URIs in "X-Accel-Redirect" headers. - - *) Feature: the "ssl_buffer_size" directive. - - *) Feature: the "limit_rate" directive can now be used to rate limit - responses sent in SPDY connections. - - *) Feature: the "spdy_chunk_size" directive. - - *) Feature: the "ssl_session_tickets" directive. - Thanks to Dirkjan Bussink. +Changes with nginx 1.4.5 11 Feb 2014 *) Bugfix: the $ssl_session_id variable contained full session serialized instead of just a session id. Thanks to Ivan Ristić. - *) Bugfix: nginx incorrectly handled escaped "?" character in the - "include" SSI command. - - *) Bugfix: the ngx_http_dav_module did not unescape destination URI of - the COPY and MOVE methods. - - *) Bugfix: resolver did not understand domain names with a trailing dot. - Thanks to Yichun Zhang. + *) Bugfix: client connections might be immediately closed if deferred + accept was used; the bug had appeared in 1.3.15. *) Bugfix: alerts "zero size buf in output" might appear in logs while proxying; the bug had appeared in 1.3.9. @@ -170,217 +41,53 @@ Changes with nginx 1.5.9 22 Jan 2014 *) Bugfix: proxied WebSocket connections might hang right after handshake if the select, poll, or /dev/poll methods were used. - *) Bugfix: the "xclient" directive of the mail proxy module incorrectly - handled IPv6 client addresses. - - -Changes with nginx 1.5.8 17 Dec 2013 - - *) Feature: IPv6 support in resolver. - - *) Feature: the "listen" directive supports the "fastopen" parameter. - Thanks to Mathew Rodley. - - *) Feature: SSL support in the ngx_http_uwsgi_module. - Thanks to Roberto De Ioris. - - *) Feature: vim syntax highlighting scripts were added to contrib. - Thanks to Evan Miller. - *) Bugfix: a timeout might occur while reading client request body in an SSL connection using chunked transfer encoding. - *) Bugfix: the "master_process" directive did not work correctly in - nginx/Windows. - - *) Bugfix: the "setfib" parameter of the "listen" directive might not - work. - - *) Bugfix: in the ngx_http_spdy_module. + *) Bugfix: memory leak in nginx/Windows. -Changes with nginx 1.5.7 19 Nov 2013 +Changes with nginx 1.4.4 19 Nov 2013 *) Security: a character following an unescaped space in a request line was handled incorrectly (CVE-2013-4547); the bug had appeared in 0.8.41. Thanks to Ivan Fratric of the Google Security Team. - *) Change: a logging level of auth_basic errors about no user/password - provided has been lowered from "error" to "info". - *) Feature: the "proxy_cache_revalidate", "fastcgi_cache_revalidate", - "scgi_cache_revalidate", and "uwsgi_cache_revalidate" directives. - - *) Feature: the "ssl_session_ticket_key" directive. - Thanks to Piotr Sikora. - - *) Bugfix: the directive "add_header Cache-Control ''" added a - "Cache-Control" response header line with an empty value. - - *) Bugfix: the "satisfy any" directive might return 403 error instead of - 401 if auth_request and auth_basic directives were used. - Thanks to Jan Marc Hoffmann. - - *) Bugfix: the "accept_filter" and "deferred" parameters of the "listen" - directive were ignored for listen sockets created during binary - upgrade. - Thanks to Piotr Sikora. - - *) Bugfix: some data received from a backend with unbufferred proxy - might not be sent to a client immediately if "gzip" or "gunzip" - directives were used. - Thanks to Yichun Zhang. - - *) Bugfix: in error handling in ngx_http_gunzip_filter_module. - - *) Bugfix: responses might hang if the ngx_http_spdy_module was used - with the "auth_request" directive. - - *) Bugfix: memory leak in nginx/Windows. - - -Changes with nginx 1.5.6 01 Oct 2013 - - *) Feature: the "fastcgi_buffering" directive. - - *) Feature: the "proxy_ssl_protocols" and "proxy_ssl_ciphers" - directives. - Thanks to Piotr Sikora. - - *) Feature: optimization of SSL handshakes when using long certificate - chains. - - *) Feature: the mail proxy supports SMTP pipelining. - - *) Bugfix: in the ngx_http_auth_basic_module when using "$apr1$" - password encryption method. - Thanks to Markus Linnala. - - *) Bugfix: in MacOSX, Cygwin, and nginx/Windows incorrect location might - be used to process a request if locations were given using characters - in different cases. - - *) Bugfix: automatic redirect with appended trailing slash for proxied - locations might not work. - - *) Bugfix: in the mail proxy server. - - *) Bugfix: in the ngx_http_spdy_module. - - -Changes with nginx 1.5.5 17 Sep 2013 - - *) Change: now nginx assumes HTTP/1.0 by default if it is not able to - detect protocol reliably. - - *) Feature: the "disable_symlinks" directive now uses O_PATH on Linux. - - *) Feature: now nginx uses EPOLLRDHUP events to detect premature - connection close by clients if the "epoll" method is used. - - *) Bugfix: in the "valid_referers" directive if the "server_names" - parameter was used. - - *) Bugfix: the $request_time variable did not work in nginx/Windows. - - *) Bugfix: in the "image_filter" directive. - Thanks to Lanshun Zhou. - - *) Bugfix: OpenSSL 1.0.1f compatibility. - Thanks to Piotr Sikora. - - -Changes with nginx 1.5.4 27 Aug 2013 - - *) Change: the "js" extension MIME type has been changed to - "application/javascript"; default value of the "charset_types" - directive was changed accordingly. - - *) Change: now the "image_filter" directive with the "size" parameter - returns responses with the "application/json" MIME type. - - *) Feature: the ngx_http_auth_request_module. - - *) Bugfix: a segmentation fault might occur on start or during - reconfiguration if the "try_files" directive was used with an empty - parameter. - - *) Bugfix: memory leak if relative paths were specified using variables - in the "root" or "auth_basic_user_file" directives. - - *) Bugfix: the "valid_referers" directive incorrectly executed regular - expressions if a "Referer" header started with "https://". - Thanks to Liangbin Li. - - *) Bugfix: responses might hang if subrequests were used and an SSL - handshake error happened during subrequest processing. - Thanks to Aviram Cohen. - - *) Bugfix: in the ngx_http_autoindex_module. - - *) Bugfix: in the ngx_http_spdy_module. - - -Changes with nginx 1.5.3 30 Jul 2013 - - *) Change in internal API: now u->length defaults to -1 if working with - backends in unbuffered mode. - - *) Change: now after receiving an incomplete response from a backend - server nginx tries to send an available part of the response to a - client, and then closes client connection. +Changes with nginx 1.4.3 08 Oct 2013 *) Bugfix: a segmentation fault might occur in a worker process if the ngx_http_spdy_module was used with the "client_body_in_file_only" directive. - *) Bugfix: the "so_keepalive" parameter of the "listen" directive might - be handled incorrectly on DragonFlyBSD. - Thanks to Sepherosa Ziehau. + *) Bugfix: a segmentation fault might occur on start or during + reconfiguration if the "try_files" directive was used with an empty + parameter. - *) Bugfix: in the ngx_http_xslt_filter_module. + *) Bugfix: the $request_time variable did not work in nginx/Windows. - *) Bugfix: in the ngx_http_sub_filter_module. + *) Bugfix: in the ngx_http_auth_basic_module when using "$apr1$" + password encryption method. + Thanks to Markus Linnala. + + *) Bugfix: in the ngx_http_autoindex_module. + + *) Bugfix: in the mail proxy server. -Changes with nginx 1.5.2 02 Jul 2013 - - *) Feature: now several "error_log" directives can be used. +Changes with nginx 1.4.2 17 Jul 2013 *) Bugfix: the $r->header_in() embedded perl method did not return value of the "Cookie" and "X-Forwarded-For" request header lines; the bug had appeared in 1.3.14. - *) Bugfix: in the ngx_http_spdy_module. - Thanks to Jim Radford. - - *) Bugfix: nginx could not be built on Linux with x32 ABI. - Thanks to Serguei Ivantsov. - - -Changes with nginx 1.5.1 04 Jun 2013 - - *) Feature: the "ssi_last_modified", "sub_filter_last_modified", and - "xslt_last_modified" directives. - Thanks to Alexey Kolpakov. - - *) Feature: the "http_403" parameter of the "proxy_next_upstream", - "fastcgi_next_upstream", "scgi_next_upstream", and - "uwsgi_next_upstream" directives. - - *) Feature: the "allow" and "deny" directives now support unix domain - sockets. - *) Bugfix: nginx could not be built with the ngx_mail_ssl_module, but without ngx_http_ssl_module; the bug had appeared in 1.3.14. *) Bugfix: in the "proxy_set_body" directive. Thanks to Lanshun Zhou. - *) Bugfix: in the "lingering_time" directive. - Thanks to Lanshun Zhou. - *) Bugfix: the "fail_timeout" parameter of the "server" directive in the "upstream" context might not work if "max_fails" parameter was used; the bug had appeared in 1.3.0. @@ -389,14 +96,11 @@ Changes with nginx 1.5.1 04 Jun 2013 "ssl_stapling" directive was used. Thanks to Piotr Sikora. - *) Bugfix: in the mail proxy server. - Thanks to Filipe Da Silva. - *) Bugfix: nginx/Windows might stop accepting connections if several worker processes were used. -Changes with nginx 1.5.0 07 May 2013 +Changes with nginx 1.4.1 07 May 2013 *) Security: a stack-based buffer overflow might occur in a worker process while handling a specially crafted request, potentially @@ -6393,7 +6097,7 @@ Changes with nginx 0.1.16 25 Jan 2005 *) Bugfix: the compressed response encrypted by SSL may not transferred complete. - *) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPUSH, and TCP_CORK + *) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK options, are not used for the unix domain sockets. *) Feature: the rewrite directive supports the arguments rewriting. diff --git a/Dengine/tengine/CHANGES.cn b/Dengine/tengine/CHANGES.cn index fe54265..cf8ebc5 100644 --- a/Dengine/tengine/CHANGES.cn +++ b/Dengine/tengine/CHANGES.cn @@ -1,40 +1,3 @@ -Tengine 2.1.1 [2015-08-12] -* Feature: 支持动态upstream更新 [yzprofile] -* Feature: 增强ngx_http_reqstat_module模块 [cfsego] -* Feature: 增加ssl_verify_client_exception指令 [InfoHunter] -* Change: 降低解析配置的内存消耗 [ilexshen] -* Change: trim模块增加$trim_bytes和$trim_original_bytes [taoyuanyuan] -* Change: 升级debian二进制包的版本到2.1.0 [PeterDaveHello] -* Change: 将ngx_http_spdy_module模块集成到travis-ci自动编译 [chobits] -* Change: 更新SPDY/3.1 [chobits] -* Change: SPDY时关闭proxy_request_buffering指令 [chobits] -* Change: 增加编译选项支持设置linker [tanguofu] -* Bugfix: 修复SPDY的Backport bug [nginx official, ym] -* Bugfix: SPDY和SSL模块一起编译时报错 [ym] -* Bugfix: 修复打开reuseport的bug [monadbobo] - -Tengine 2.1.0 [2014-12-19] -* Feature: 支持SO_REUSEPORT选项,以提升CPU负载均衡性和性能 [monadbobo] -* Feature: 支持动态解析upstream中出现的域名 [InfoHunter] -* Feature: rewrite指令支持重定向到命名location [yzprofile] -* Feature: image_filter指令支持crop_keepx和crop_keepy参数 [Lax] -* Feature: consistent_hash模块和session_sticky模块支持SSL会话保持 [dinic] -* Feature: 支持travis-ci.org自动编译 [Jamyn] -* Feature: 健康检查模块支持FASTCGI检查 [yzprofile] -* Feature: 增强sysguard模块的功能 [InfoHunter] -* Feature: 新增变量$normalized_request得到规范化的请求 [yunkai] -* Feature: dso的include指令支持通配符 [monadbobo] -* Feature: 新增gzip_clear_etag指令 [taoyuanyuan] -* Feature: 为log_escape指令添加unprintable参数 [skoo87] -* Change: 合并nginx-1.6.2版本的修改 [cfsego, taoyuanyuan, chobits] -* Change: round robin负载均衡算法随机选择某个源站作为循环起点 [taoyuanyuan] -* Change: 对共享内存中的碎片进行优化 [chobits] -* Bugfix: SPDY/3关闭连接时去掉drop标志 [chobits] -* Bugfix: 修复SPDY/3出现连接泄漏的问题 [chobits] -* Bugfix: 修复limit_req模块将长度超过255个字符的key截断的问题 [chobits] -* Bugfix: 解析/etc/resolv.conf中的IPv6地址出错 [lifeibo] -* Bugfix: 通过红黑树查找到错误的upstream [taoyuanyuan] - Tengine 2.0.3 [2014-05-30] * Feature: 支持按指定维度(域名,url等)收集Tengine运行状态 [cfsego] * Feature: 支持debian、ubuntu打包 [betetrpm, szepeviktor] diff --git a/Dengine/tengine/CHANGES.ru b/Dengine/tengine/CHANGES.ru index aa15be6..2f9f301 100644 --- a/Dengine/tengine/CHANGES.ru +++ b/Dengine/tengine/CHANGES.ru @@ -1,69 +1,5 @@ -Изменения в nginx 1.6.2 16.09.2014 - - *) Безопасность: при использовании общего для нескольких блоков server - разделяемого кэша SSL-сессий или общего ключа для шифрования TLS - session tickets было возможно повторно использовать SSL-сессию в - контексте другого блока server (CVE-2014-3616). - Спасибо Antoine Delignat-Lavaud. - - *) Исправление: запросы могли зависать, если использовался resolver и - DNS-сервер возвращал некорректный ответ; ошибка появилась в 1.5.8. - - *) Исправление: запросы могли зависать, если использовался resolver и в - процессе обращения к DNS-серверу происходил таймаут. - - -Изменения в nginx 1.6.1 05.08.2014 - - *) Безопасность: pipelined-команды не отбрасывались после команды - STARTTLS в SMTP прокси-сервере (CVE-2014-3556); ошибка появилась в - 1.5.6. - Спасибо Chris Boulton. - - *) Исправление: переменная $uri могла содержать мусор при возврате - ошибок с кодом 400. - Спасибо Сергею Боброву. - - *) Исправление: в работе параметра none директивы smtp_auth; ошибка - появилась в 1.5.6. - Спасибо Святославу Никольскому. - - -Изменения в nginx 1.6.0 24.04.2014 - - *) Стабильная ветка 1.6.x. - - -Изменения в nginx 1.5.13 08.04.2014 - - *) Изменение: улучшена обработка хэш-таблиц; в директивах - variables_hash_max_size и types_hash_bucket_size значения по - умолчанию изменены на 1024 и 64 соответственно. - - *) Добавление: модуль ngx_http_mp4_module теперь понимает аргумент end. - - *) Добавление: поддержка byte ranges модулем ngx_http_mp4_module и при - сохранении ответов в кэш. - - *) Исправление: теперь nginx не пишет в лог сообщения "ngx_slab_alloc() - failed: no memory" при использовании разделяемой памяти в - ssl_session_cache и в модуле ngx_http_limit_req_module. - - *) Исправление: директива underscores_in_headers не разрешала - подчёркивание в первом символе заголовка. - Спасибо Piotr Sikora. - - *) Исправление: cache manager мог нагружать процессор при выходе в - nginx/Windows. - - *) Исправление: при использовании ssl_session_cache с параметром shared - рабочий процесс nginx/Windows завершался аварийно. - - *) Исправление: в модуле ngx_http_spdy_module. - - -Изменения в nginx 1.5.12 18.03.2014 +Изменения в nginx 1.4.7 18.03.2014 *) Безопасность: при обработке специально созданного запроса модулем ngx_http_spdy_module могло происходить переполнение буфера в рабочем @@ -72,24 +8,11 @@ Спасибо Lucas Molas из Programa STIC, Fundación Dr. Manuel Sadosky, Buenos Aires, Argentina. - *) Добавление: параметр proxy_protocol в директивах listen и - real_ip_header, переменная $proxy_protocol_addr. - *) Исправление: в директиве fastcgi_next_upstream. Спасибо Lucas Molas. -Изменения в nginx 1.5.11 04.03.2014 - - *) Безопасность: при обработке специально созданного запроса модулем - ngx_http_spdy_module на 32-битных платформах могла повреждаться - память рабочего процесса, что потенциально могло приводить к - выполнению произвольного кода (CVE-2014-0088); ошибка появилась в - 1.5.10. - Спасибо Lucas Molas из Programa STIC, Fundación Dr. Manuel Sadosky, - Buenos Aires, Argentina. - - *) Добавление: переменная $ssl_session_reused. +Изменения в nginx 1.4.6 04.03.2014 *) Исправление: директива client_max_body_size могла не работать при чтении тела запроса с использованием chunked transfer encoding; @@ -99,74 +22,15 @@ *) Исправление: при проксировании WebSocket-соединений в рабочем процессе мог произойти segmentation fault. - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если использовался модуль ngx_http_spdy_module на 32-битных - платформах; ошибка появилась в 1.5.10. - *) Исправление: значение переменной $upstream_status могло быть - неверным, если использовались директивы proxy_cache_use_stale или - proxy_cache_revalidate. - Спасибо Piotr Sikora. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если ошибки с кодом 400 с помощью директивы error_page - перенаправлялись в именованный location. - - *) Исправление: nginx/Windows не собирался с Visual Studio 2013. - - -Изменения в nginx 1.5.10 04.02.2014 - - *) Добавление: модуль ngx_http_spdy_module теперь использует протокол - SPDY 3.1. - Спасибо Automattic и MaxCDN за спонсирование разработки. - - *) Добавление: модуль ngx_http_mp4_module теперь пропускает дорожки, - имеющие меньшую длину, чем запрошенная перемотка. - - *) Исправление: в рабочем процессе мог произойти segmentation fault, - если переменная $ssl_session_id использовалась при логгировании; - ошибка появилась в 1.5.9. - - *) Исправление: переменные $date_local и $date_gmt использовали неверный - формат вне модуля ngx_http_ssi_filter_module. - - *) Исправление: клиентские соединения могли сразу закрываться, если - использовался отложенный accept; ошибка появилась в 1.3.15. - - *) Исправление: сообщения "getsockopt(TCP_FASTOPEN) ... failed" - записывались в лог в процессе обновления исполняемого файла на Linux; - ошибка появилась в 1.5.8. - Спасибо Piotr Sikora. - - -Изменения в nginx 1.5.9 22.01.2014 - - *) Изменение: теперь в заголовке X-Accel-Redirect nginx ожидает - закодированный URI. - - *) Добавление: директива ssl_buffer_size. - - *) Добавление: директиву limit_rate теперь можно использовать для - ограничения скорости передачи ответов клиенту в SPDY-соединениях. - - *) Добавление: директива spdy_chunk_size. - - *) Добавление: директива ssl_session_tickets. - Спасибо Dirkjan Bussink. +Изменения в nginx 1.4.5 11.02.2014 *) Исправление: переменная $ssl_session_id содержала всю сессию в сериализованном виде вместо её идентификатора. Спасибо Ivan Ristić. - *) Исправление: nginx неправильно обрабатывал закодированный символ "?" - в команде SSI include. - - *) Исправление: модуль ngx_http_dav_module не раскодировал целевой URI - при обработке методов COPY и MOVE. - - *) Исправление: resolver не понимал доменные имена с точкой в конце. - Спасибо Yichun Zhang. + *) Исправление: клиентские соединения могли сразу закрываться, если + использовался отложенный accept; ошибка появилась в 1.3.15. *) Исправление: при проксировании в логах могли появляться сообщения "zero size buf in output"; ошибка появилась в 1.3.9. @@ -178,219 +42,53 @@ poll и /dev/poll проксируемые WebSocket-соединения могли зависать сразу после открытия. - *) Исправление: директива xclient почтового прокси-сервера некорректно - передавала IPv6-адреса. - - -Изменения в nginx 1.5.8 17.12.2013 - - *) Добавление: теперь resolver поддерживает IPv6. - - *) Добавление: директива listen поддерживает параметр fastopen. - Спасибо Mathew Rodley. - - *) Добавление: поддержка SSL в модуле ngx_http_uwsgi_module. - Спасибо Roberto De Ioris. - - *) Добавление: скрипты подсветки синтаксиса для vim добавлены в contrib. - Спасибо Evan Miller. - *) Исправление: при чтении тела запроса с использованием chunked transfer encoding по SSL-соединению мог произойти таймаут. - *) Исправление: директива master_process работала неправильно в - nginx/Windows. - - *) Исправление: параметр setfib директивы listen мог не работать. - - *) Исправление: в модуле ngx_http_spdy_module. + *) Исправление: утечки памяти в nginx/Windows. -Изменения в nginx 1.5.7 19.11.2013 +Изменения в nginx 1.4.4 19.11.2013 *) Безопасность: символ, следующий за незакодированным пробелом в строке запроса, обрабатывался неправильно (CVE-2013-4547); ошибка появилась в 0.8.41. Спасибо Ivan Fratric из Google Security Team. - *) Изменение: уровень логгирования ошибок auth_basic об отсутствии - пароля понижен с уровня error до info. - *) Добавление: директивы proxy_cache_revalidate, - fastcgi_cache_revalidate, scgi_cache_revalidate и - uwsgi_cache_revalidate. - - *) Добавление: директива ssl_session_ticket_key. - Спасибо Piotr Sikora. - - *) Исправление: директива "add_header Cache-Control ''" добавляла строку - заголовка ответа "Cache-Control" с пустым значением. - - *) Исправление: директива "satisfy any" могла вернуть ошибку 403 вместо - 401 при использовании директив auth_request и auth_basic. - Спасибо Jan Marc Hoffmann. - - *) Исправление: параметры accept_filter и deferred директивы listen - игнорировались для listen-сокетов, создаваемых в процессе обновления - исполняемого файла. - Спасибо Piotr Sikora. - - *) Исправление: часть данных, полученных от бэкенда при - небуферизированном проксировании, могла не отправляться клиенту - сразу, если использовались директивы gzip или gunzip. - Спасибо Yichun Zhang. - - *) Исправление: в обработке ошибок в модуле - ngx_http_gunzip_filter_module. - - *) Исправление: ответы могли зависать, если использовался модуль - ngx_http_spdy_module и директива auth_request. - - *) Исправление: утечки памяти в nginx/Windows. - - -Изменения в nginx 1.5.6 01.10.2013 - - *) Добавление: директива fastcgi_buffering. - - *) Добавление: директивы proxy_ssl_protocols и proxy_ssl_ciphers. - Спасибо Piotr Sikora. - - *) Добавление: оптимизация SSL handshake при использовании длинных - цепочек сертификатов. - - *) Добавление: почтовый прокси-сервер поддерживает SMTP pipelining. - - *) Исправление: в модуле ngx_http_auth_basic_module при использовании - метода шифрования паролей "$apr1$". - Спасибо Markus Linnala. - - *) Исправление: на MacOSX, Cygwin и nginx/Windows для обработки запроса - мог использоваться неверный location, если для задания location'ов - использовались символы разных регистров. - - *) Исправление: автоматическое перенаправление с добавлением - завершающего слэша для проксированных location'ов могло не работать. - - *) Исправление: в почтовом прокси-сервере. - - *) Исправление: в модуле ngx_http_spdy_module. - - -Изменения в nginx 1.5.5 17.09.2013 - - *) Изменение: теперь nginx по умолчанию использует HTTP/1.0, если точно - определить протокол не удалось. - - *) Добавление: директива disable_symlinks теперь использует O_PATH на - Linux. - - *) Добавление: для определения того, что клиент закрыл соединение, при - использовании метода epoll теперь используются события EPOLLRDHUP. - - *) Исправление: в директиве valid_referers при использовании параметра - server_names. - - *) Исправление: переменная $request_time не работала в nginx/Windows. - - *) Исправление: в директиве image_filter. - Спасибо Lanshun Zhou. - - *) Исправление: совместимость с OpenSSL 1.0.1f. - Спасибо Piotr Sikora. - - -Изменения в nginx 1.5.4 27.08.2013 - - *) Изменение: MIME-тип для расширения js изменён на - "application/javascript"; значение по умолчанию директивы - charset_types изменено соответственно. - - *) Изменение: теперь директива image_filter с параметром size возвращает - ответ с MIME-типом "application/json". - - *) Добавление: модуль ngx_http_auth_request_module. - - *) Исправление: на старте или во время переконфигурации мог произойти - segmentation fault, если использовалась директива try_files с пустым - параметром. - - *) Исправление: утечки памяти при использовании в директивах root и - auth_basic_user_file относительных путей, заданных с помощью - переменных. - - *) Исправление: директива valid_referers неправильно выполняла - регулярные выражения, если заголовок Referer начинался с "https://". - Спасибо Liangbin Li. - - *) Исправление: ответы могли зависать, если использовались подзапросы и - при обработке подзапроса происходила ошибка во время SSL handshake с - бэкендом. - Спасибо Aviram Cohen. - - *) Исправление: в модуле ngx_http_autoindex_module. - - *) Исправление: в модуле ngx_http_spdy_module. - - -Изменения в nginx 1.5.3 30.07.2013 - - *) Изменение во внутреннем API: теперь при небуферизированной работе с - бэкендами u->length по умолчанию устанавливается в -1. - - *) Изменение: теперь при получении неполного ответа от бэкенда nginx - отправляет полученную часть ответа, после чего закрывает соединение с - клиентом. +Изменения в nginx 1.4.3 08.10.2013 *) Исправление: в рабочем процессе мог произойти segmentation fault, если использовался модуль ngx_http_spdy_module и директива client_body_in_file_only. - *) Исправление: параметр so_keepalive директивы listen мог работать - некорректно на DragonFlyBSD. - Спасибо Sepherosa Ziehau. + *) Исправление: на старте или во время переконфигурации мог произойти + segmentation fault, если использовалась директива try_files с пустым + параметром. - *) Исправление: в модуле ngx_http_xslt_filter_module. + *) Исправление: переменная $request_time не работала в nginx/Windows. - *) Исправление: в модуле ngx_http_sub_filter_module. + *) Исправление: в модуле ngx_http_auth_basic_module при использовании + метода шифрования паролей "$apr1$". + Спасибо Markus Linnala. + + *) Исправление: в модуле ngx_http_autoindex_module. + + *) Исправление: в почтовом прокси-сервере. -Изменения в nginx 1.5.2 02.07.2013 - - *) Добавление: теперь можно использовать несколько директив error_log. +Изменения в nginx 1.4.2 17.07.2013 *) Исправление: метод $r->header_in() встроенного перла не возвращал значения строк "Cookie" и "X-Forwarded-For" из заголовка запроса; ошибка появилась в 1.3.14. - *) Исправление: в модуле ngx_http_spdy_module. - Спасибо Jim Radford. - - *) Исправление: nginx не собирался на Linux при использовании x32 ABI. - Спасибо Сергею Иванцову. - - -Изменения в nginx 1.5.1 04.06.2013 - - *) Добавление: директивы ssi_last_modified, sub_filter_last_modified и - xslt_last_modified. - Спасибо Алексею Колпакову. - - *) Добавление: параметр http_403 в директивах proxy_next_upstream, - fastcgi_next_upstream, scgi_next_upstream и uwsgi_next_upstream. - - *) Добавление: директивы allow и deny теперь поддерживают unix domain - сокеты. - *) Исправление: nginx не собирался с модулем ngx_mail_ssl_module, но без модуля ngx_http_ssl_module; ошибка появилась в 1.3.14. *) Исправление: в директиве proxy_set_body. Спасибо Lanshun Zhou. - *) Исправление: в директиве lingering_time. - Спасибо Lanshun Zhou. - *) Исправление: параметр fail_timeout директивы server в блоке upstream мог не работать, если использовался параметр max_fails; ошибка появилась в 1.3.0. @@ -399,14 +97,11 @@ если использовалась директива ssl_stapling. Спасибо Piotr Sikora. - *) Исправление: в почтовом прокси-сервере. - Спасибо Filipe Da Silva. - *) Исправление: nginx/Windows мог перестать принимать соединения, если использовалось несколько рабочих процессов. -Изменения в nginx 1.5.0 07.05.2013 +Изменения в nginx 1.4.1 07.05.2013 *) Безопасность: при обработке специально созданного запроса мог перезаписываться стек рабочего процесса, что могло приводить к @@ -732,7 +427,7 @@ *) Изменение: параметр single директивы keepalive теперь игнорируется. *) Изменение: сжатие SSL теперь отключено в том числе при использовании - OpenSSL старее 1.0.0. + OpenSSL cтарее 1.0.0. *) Добавление: директиву "ip_hash" теперь можно использовать для балансировки IPv6 клиентов. @@ -3009,7 +2704,7 @@ умолчанию; ошибка появилась в 0.7.18. Спасибо Максиму Дунину. - *) Исправление: при проксировании SMTP nginx выдавал сообщение + *) Исправление: при проксировании SMPT nginx выдавал сообщение "250 2.0.0 OK" вместо "235 2.0.0 OK"; ошибка появилась в 0.7.22. Спасибо Максиму Дунину. @@ -6495,7 +6190,7 @@ *) Исправление: при использовании SSL сжатый ответ мог передаваться не до конца. - *) Исправление: опции TCP_NODELAY, TCP_NOPUSH и TCP_CORK, специфичные + *) Исправление: опции TCP_NODELAY, TCP_NOPSUH и TCP_CORK, специфичные для TCP сокетов, не используются для unix domain сокетов. *) Добавление: директива rewrite поддерживает перезаписывание @@ -6559,7 +6254,7 @@ *) Изменение: если в URI встречался символ %3F, то он считался началом строки аргументов. - *) Добавление: поддержка unix domain сокетов в модуле + *) Добавление: поддержка unix domain сoкетов в модуле ngx_http_proxy_module. *) Добавление: директивы ssl_engine и ssl_ciphers. diff --git a/Dengine/tengine/CHANGES.te b/Dengine/tengine/CHANGES.te index 3f59ca3..3b98a84 100644 --- a/Dengine/tengine/CHANGES.te +++ b/Dengine/tengine/CHANGES.te @@ -1,86 +1,3 @@ -Changes with Tengine 2.1.1 12 Aug 2015 - - *) Feature: support for dynamic upstream update. (yzprofile) - - *) Feature: enchanced ngx_http_reqstat_module. (cfsego) - - *) Feature: added ssl_verify_client_exception directive. (InfoHunter) - - *) Change: Reduced memory usage while parsing configuration. (ilexshen) - - *) Change: added $trim_bytes and $trim_original_bytes. (taoyuanyuan) - - *) Change: upgrade debian package to 2.1.0 (PeterDaveHello) - - *) Change: support for auto compile for ngx_http_spdy_module. (chobits) - - *) Change: updated SPDY/3.1. (chobits) - - *) Change: disabled 'proxy_request_buffering' for SPDY. (chobits) - - *) Change: added configue options to support set linker. (tanguofu) - - *) Bugfix: fixed Backport bug of SPDY (nginx official, ym) - - *) Bugfix: fixed compile error with SSL. (ym) - - *) Bugfix: fixed bug of reuseport. (monadbobo) - - -Changes with Tengine 2.1.0 19 Dec 2014 - - *) Feature: support the SO_REUSEPORT option, to improve performance on - multicore systems. (monadbobo) - - *) Feature: support for resolving upstream domain names on the fly. - (InfoHunter) - - *) Feature: support for rewriting to named locations. (yzprofile) - - *) Feature: added two parameters 'crop_keepx' and 'crop_keepy' to the - directive 'image_filter'. (Lax) - - *) Feature: support for saving SSL sessions in consistent_hash module and - session_sticky module. (dinic) - - *) Feature: support for compiling Tengine automatically in travis-ci.org. - (Jamyn) - - *) Feature: support for FastCGI health check. (yzprofile) - - *) Feature: enhanced sysguard module. (InfoHunter) - - *) Feature: added a variable '$normalized_request', to get normalized - request URIs. (yunkai) - - *) Feature: added wildcard support for 'include' directive in 'dso' block. - (monadbobo) - - *) Feature: added the 'gzip_clear_etag' directive. (taoyuanyuan) - - *) Feature: added the 'unprintable' parameter to the 'log_escape' directive. - (skoo87) - - *) Change: merged changes from nginx-1.6.2. (cfsego, taoyuanyuan, chobits) - - *) Change: now the order of servers in an upstream are random when - initialized. (taoyuanyuan) - - *) Change: slab allocator free pages defragmentation. (chobits) - - *) Bugfix: SPDY/3 dropped the "delayed" flag when finalizing connection. - (chobits) - - *) Bugfix: fixed SPDY/3 connection leak. (chobits) - - *) Bugfix: now don't truncate value of key to 255 bytes in limit_req module. - (chobits) - - *) Bugfix: failed to parse /etc/resolv.conf with IPv6 addresses. (lifeibo) - - *) Bugfix: upstream rbtree bugfix. (taoyuanyuan) - - Changes with Tengine 2.0.3 30 May 2014 *) Feature: added support for collecting the running status of Tengine diff --git a/Dengine/tengine/LICENSE b/Dengine/tengine/LICENSE index 0b2ce6f..0f67940 100644 --- a/Dengine/tengine/LICENSE +++ b/Dengine/tengine/LICENSE @@ -1,7 +1,7 @@ /* * Copyright (C) 2002-2013 Igor Sysoev * Copyright (C) 2011,2013 Nginx, Inc. - * Copyright (C) 2010-2015 Alibaba Group Holding Limited + * Copyright (C) 2010-2014 Alibaba Group Holding Limited * Copyright (C) 2011-2013 Xiaozhe "chaoslawful" Wang * Copyright (C) 2011-2013 Zhang "agentzh" Yichun * Copyright (C) 2011-2013 Weibin Yao diff --git a/Dengine/tengine/README b/Dengine/tengine/README index 47bcaa5..faa01f2 100644 --- a/Dengine/tengine/README +++ b/Dengine/tengine/README @@ -8,7 +8,7 @@ Tengine has been an open source project since December 2011. It is being activel Features -------- -* All features of nginx-1.6.2 are inherited, i.e., it is 100% compatible with nginx. +* All features of nginx-1.4.4 are inherited, i.e., it is 100% compatible with nginx. * Dynamic module loading support. You don't need to recompile Tengine when adding new modules to it. * SPDY v3 support, and SPDY/HTTP servers can listen on the same port. * Sends unbuffered upload directly to HTTP and FastCGI backend servers, which saves disk I/Os. diff --git a/Dengine/tengine/README.markdown b/Dengine/tengine/README.markdown index 54d2607..c7106c6 100644 --- a/Dengine/tengine/README.markdown +++ b/Dengine/tengine/README.markdown @@ -1,5 +1,5 @@ -Introduction [![Build Status](https://travis-ci.org/alibaba/tengine.svg?branch=master)](https://travis-ci.org/alibaba/tengine) +Introduction ============ Tengine is a web server originated by [Taobao](http://en.wikipedia.org/wiki/Taobao), the largest e-commerce website in Asia. It is based on the [Nginx](http://nginx.org) HTTP server and has many advanced features. Tengine has proven to be very stable and efficient on some of the top 100 websites in the world, including [taobao.com](http://www.taobao.com) and [tmall.com](http://www.tmall.com). @@ -9,7 +9,7 @@ Tengine has been an open source project since December 2011. It is being activel Features ======== -* All features of nginx-1.6.2 are inherited, i.e., it is 100% compatible with nginx. +* All features of nginx-1.4.4 are inherited, i.e., it is 100% compatible with nginx. * Dynamic module loading support. You don't need to recompile Tengine when adding new modules to it. * SPDY v3 support, and SPDY/HTTP servers can listen on the same port. * Sends unbuffered upload directly to HTTP and FastCGI backend servers, which saves disk I/Os. diff --git a/Dengine/tengine/auto/cc/clang b/Dengine/tengine/auto/cc/clang index a8aa160..9f60d7b 100644 --- a/Dengine/tengine/auto/cc/clang +++ b/Dengine/tengine/auto/cc/clang @@ -5,8 +5,8 @@ # clang -NGX_CLANG_VER=`$CC -v 2>&1 | grep '\(clang\|LLVM\) version' 2>&1 \ - | sed -e 's/^.* version \(.*\)/\1/'` +NGX_CLANG_VER=`$CC -v 2>&1 | grep 'clang version' 2>&1 \ + | sed -e 's/^.*clang version \(.*\)/\1/'` echo " + clang version: $NGX_CLANG_VER" @@ -82,14 +82,13 @@ fi # warnings CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith" -#CFLAGS="$CFLAGS -Wconditional-uninitialized" #CFLAGS="$CFLAGS -Wmissing-prototypes" # we have a lot of unused function arguments CFLAGS="$CFLAGS -Wno-unused-parameter" # stop on warning -CFLAGS="$CFLAGS -Werror" +#CFLAGS="$CFLAGS -Werror" # debug CFLAGS="$CFLAGS -g" diff --git a/Dengine/tengine/auto/cc/conf b/Dengine/tengine/auto/cc/conf index 74c8ff4..d0b0d22 100644 --- a/Dengine/tengine/auto/cc/conf +++ b/Dengine/tengine/auto/cc/conf @@ -3,7 +3,7 @@ # Copyright (C) Nginx, Inc. -LINK=${LINK:-"\$(CC)"} +LINK="\$(CC)" ngx_include_opt="-I " ngx_compile_opt="-c" @@ -43,29 +43,6 @@ if test -n "$CFLAGS"; then ngx_include_opt="-I" ;; - sunc) - - case "$NGX_MACHINE" in - - i86pc) - NGX_AUX=" src/os/unix/ngx_sunpro_x86.il" - ;; - - sun4u | sun4v) - NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il" - ;; - - esac - - case $CPU in - - amd64) - NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il" - ;; - - esac - ;; - esac else diff --git a/Dengine/tengine/auto/cc/msvc b/Dengine/tengine/auto/cc/msvc index 393ba32..1bf675e 100644 --- a/Dengine/tengine/auto/cc/msvc +++ b/Dengine/tengine/auto/cc/msvc @@ -106,7 +106,6 @@ fi # precompiled headers CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch" -CORE_LINK="$CORE_LINK $NGX_OBJS/ngx_pch.obj" NGX_PCH="$NGX_OBJS/ngx_config.pch" NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch" NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch" diff --git a/Dengine/tengine/auto/cc/name b/Dengine/tengine/auto/cc/name index 51a7ed9..7a5656c 100644 --- a/Dengine/tengine/auto/cc/name +++ b/Dengine/tengine/auto/cc/name @@ -67,7 +67,7 @@ elif `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then NGX_CC_NAME=gcc echo " + using GNU C compiler" -elif `$CC -v 2>&1 | grep '\(clang\|LLVM\) version' >/dev/null 2>&1`; then +elif `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then NGX_CC_NAME=clang echo " + using Clang C compiler" diff --git a/Dengine/tengine/auto/cc/owc b/Dengine/tengine/auto/cc/owc index a063aa3..22eb4c1 100644 --- a/Dengine/tengine/auto/cc/owc +++ b/Dengine/tengine/auto/cc/owc @@ -65,10 +65,10 @@ have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have # the precompiled headers -#CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch" -#NGX_PCH="$NGX_OBJS/ngx_config.pch" -#NGX_BUILD_PCH="-fhq=$NGX_OBJS/ngx_config.pch" -#NGX_USE_PCH="-fh=$NGX_OBJS/ngx_config.pch" +CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch" +NGX_PCH="$NGX_OBJS/ngx_config.pch" +NGX_BUILD_PCH="-fhq=$NGX_OBJS/ngx_config.pch" +NGX_USE_PCH="-fh=$NGX_OBJS/ngx_config.pch" # the link flags, built target is NT GUI mode application diff --git a/Dengine/tengine/auto/cc/sunc b/Dengine/tengine/auto/cc/sunc index 8f12d7c..dd9cced 100644 --- a/Dengine/tengine/auto/cc/sunc +++ b/Dengine/tengine/auto/cc/sunc @@ -30,7 +30,7 @@ if [ -x $NGX_AUTOTEST ]; then ngx_sunc_ver=`$NGX_AUTOTEST` fi -rm -rf $NGX_AUTOTEST* +rm $NGX_AUTOTEST* # 1424 == 0x590, Sun Studio 12 diff --git a/Dengine/tengine/auto/endianness b/Dengine/tengine/auto/endianness index 93da2f8..87311a0 100644 --- a/Dengine/tengine/auto/endianness +++ b/Dengine/tengine/auto/endianness @@ -34,10 +34,10 @@ if [ -x $NGX_AUTOTEST ]; then echo " big endian" fi - rm -rf $NGX_AUTOTEST* + rm $NGX_AUTOTEST* else - rm -rf $NGX_AUTOTEST* + rm $NGX_AUTOTEST* echo echo "$0: error: cannot detect system byte ordering" diff --git a/Dengine/tengine/auto/feature b/Dengine/tengine/auto/feature index 1145f28..c13e51d 100644 --- a/Dengine/tengine/auto/feature +++ b/Dengine/tengine/auto/feature @@ -120,4 +120,4 @@ else echo "----------" >> $NGX_AUTOCONF_ERR fi -rm -rf $NGX_AUTOTEST* +rm $NGX_AUTOTEST* diff --git a/Dengine/tengine/auto/include b/Dengine/tengine/auto/include index e34dabd..3466fda 100644 --- a/Dengine/tengine/auto/include +++ b/Dengine/tengine/auto/include @@ -58,4 +58,4 @@ else echo "----------" >> $NGX_AUTOCONF_ERR fi -rm -rf $NGX_AUTOTEST* +rm $NGX_AUTOTEST* diff --git a/Dengine/tengine/auto/make b/Dengine/tengine/auto/make index 80bf7db..be801fa 100644 --- a/Dengine/tengine/auto/make +++ b/Dengine/tengine/auto/make @@ -20,7 +20,7 @@ mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \ $NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \ $NGX_OBJS/src/http $NGX_OBJS/src/http/modules \ $NGX_OBJS/src/http/modules/perl \ - $NGX_OBJS/modules/ngx_http_lua_module/src \ + $NGX_OBJS/src/http/modules/lua \ $NGX_OBJS/src/http/modules/tfs \ $NGX_OBJS/src/mail \ $NGX_OBJS/src/misc \ @@ -628,7 +628,7 @@ END cat << END > $NGX_DSO_COMPILE #!/bin/sh -# Copyright (C) 2010-2015 Alibaba Group Holding Limited +# Copyright (C) 2010-2014 Alibaba Group Holding Limited ngx_soext='$NGX_SOEXT' diff --git a/Dengine/tengine/auto/modules b/Dengine/tengine/auto/modules index a924dca..b51ab22 100644 --- a/Dengine/tengine/auto/modules +++ b/Dengine/tengine/auto/modules @@ -1,3 +1,4 @@ + # Copyright (C) Igor Sysoev # Copyright (C) Nginx, Inc. @@ -41,7 +42,6 @@ fi if [ $NGX_TEST_BUILD_EPOLL = YES ]; then have=NGX_HAVE_EPOLL . auto/have - have=NGX_HAVE_EPOLLRDHUP . auto/have have=NGX_HAVE_EVENTFD . auto/have have=NGX_TEST_BUILD_EPOLL . auto/have EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" @@ -324,11 +324,6 @@ if [ $HTTP_CONCAT_SHARED = YES ]; then NGX_SHARED_SRCS="$NGX_SHARED_SRCS|$HTTP_CONCAT_SRCS" fi -if [ $HTTP_AUTH_REQUEST = YES ]; then - HTTP_MODULES="$HTTP_MODULES $HTTP_AUTH_REQUEST_MODULE" - HTTP_SRCS="$HTTP_SRCS $HTTP_AUTH_REQUEST_SRCS" -fi - if [ $HTTP_AUTH_BASIC = YES ]; then USE_MD5=YES USE_SHA1=YES @@ -504,13 +499,18 @@ if [ $HTTP_PERL = YES ]; then fi if [ $HTTP_LUA = YES ]; then - NGX_ADDONS="$NGX_ADDONS modules/ngx_http_lua_module" + USE_MD5=YES + USE_SHA1=YES + CORE_INCS="$CORE_INCS src/http/modules/lua/api" + HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $NGX_HTTP_LUA_MODULE" + HTTP_DEPS="$HTTP_DEPS $NGX_HTTP_LUA_MODULE_DEPS" + HTTP_SRCS="$HTTP_SRCS $NGX_HTTP_LUA_MODULE_SRCS" fi if [ $HTTP_LUA_SHARED = YES ]; then USE_MD5=YES USE_SHA1=YES - CORE_INCS="$CORE_INCS modules/ngx_http_lua_module/src/api" + CORE_INCS="$CORE_INCS src/http/modules/lua/api" NGX_SHARED_MODULES="$NGX_SHARED_MODULES $NGX_HTTP_LUA_MODULE" HTTP_DEPS="$HTTP_DEPS $NGX_HTTP_LUA_MODULE_DEPS" NGX_SHARED_SRCS="$NGX_SHARED_SRCS|$NGX_HTTP_LUA_MODULE_SRCS" @@ -695,21 +695,6 @@ if [ $HTTP_UPSTREAM_KEEPALIVE = YES ]; then HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_KEEPALIVE_SRCS" fi -if [ $HTTP_UPSTREAM_DYNAMIC = YES ]; then - HTTP_MODULES="$HTTP_MODULES $HTTP_UPSTREAM_DYNAMIC_MODULE" - HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_DYNAMIC_SRCS" -fi - -if [ $HTTP_DYNAMIC_UPSTREAM = YES ]; then - HTTP_MODULES="$HTTP_MODULES $HTTP_DYUPS_MODULE" - HTTP_SRCS="$HTTP_SRCS $HTTP_DYUPS_SRCS" - if [ $HTTP_DYNAMIC_UPSTREAM_LUA = YES ]; then - HTTP_SRCS="$HTTP_SRCS $HTTP_DYUPS_LUA_SRCS" - HTTP_DEPS="$HTTP_DEPS $HTTP_DYUPS_LUA_DEPS" - have=NGX_DYUPS_LUA . auto/have - fi -fi - if [ $HTTP_STUB_STATUS = YES ]; then have=NGX_STAT_STUB . auto/have NGX_DSO_ABI_COMPATIBILITY=$(($NGX_DSO_ABI_COMPATIBILITY|$NGX_DSO_STAT_STUB_TAG)) @@ -828,8 +813,6 @@ if [ $MAIL = YES ]; then modules="$modules $MAIL_PROXY_MODULE" MAIL_SRCS="$MAIL_SRCS $MAIL_PROXY_SRCS" - - NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(MAIL_DEPS)" fi diff --git a/Dengine/tengine/auto/options b/Dengine/tengine/auto/options index 691b876..5488a7e 100644 --- a/Dengine/tengine/auto/options +++ b/Dengine/tengine/auto/options @@ -112,7 +112,6 @@ NGX_ALL_MODULES=" ngx_http_upstream_ip_hash_module ngx_http_upstream_least_conn_module ngx_http_upstream_keepalive_module - ngx_http_upstream_dynamic_module ngx_http_upstream_check_module ngx_http_upstream_consistent_hash_module ngx_http_stub_status_module @@ -220,7 +219,6 @@ HTTP_ADDITION=NO HTTP_DAV=NO HTTP_ACCESS=YES HTTP_AUTH_BASIC=YES -HTTP_AUTH_REQUEST=NO HTTP_USERID=YES HTTP_CONCAT=NO HTTP_AUTOINDEX=YES @@ -260,9 +258,6 @@ HTTP_UPSTREAM_CHECK=YES HTTP_UPSTREAM_LEAST_CONN=YES HTTP_UPSTREAM_SESSION_STICKY=YES HTTP_UPSTREAM_KEEPALIVE=YES -HTTP_UPSTREAM_DYNAMIC=YES -HTTP_DYNAMIC_UPSTREAM=NO -HTTP_DYNAMIC_UPSTREAM_LUA=NO HTTP_UPSTREAM_CONSISTENT_HASH=YES HTTP_UPSTREAM_CONSISTENT_HASH_SHARED=NO HTTP_UPSTREAM_RBTREE=YES @@ -466,7 +461,6 @@ do HTTP_MP4_SHARED=NO ;; --with-http_gunzip_module) HTTP_GUNZIP=YES ;; --with-http_gzip_static_module) HTTP_GZIP_STATIC=YES ;; - --with-http_auth_request_module) HTTP_AUTH_REQUEST=YES ;; --with-http_concat_module) HTTP_CONCAT=YES HTTP_CONCAT_SHARED=NO ;; --with-http_random_index_module) HTTP_RANDOM_INDEX=YES @@ -624,10 +618,6 @@ use the \"--without-http_limit_conn_module\" option instead" HTTP_UPSTREAM_SESSION_STICKY=NO HTTP_UPSTREAM_SESSION_STICKY_SHARED=NO ;; --without-http_upstream_keepalive_module) HTTP_UPSTREAM_KEEPALIVE=NO ;; - --without-http_upstream_dynamic_module) HTTP_UPSTREAM_DYNAMIC=NO ;; - - --with-http_dyups_module) HTTP_DYNAMIC_UPSTREAM=YES ;; - --with-http_dyups_lua_api) HTTP_DYNAMIC_UPSTREAM_LUA=YES ;; --with-http_perl_module) HTTP_PERL=YES ;; --with-perl_modules_path=*) NGX_PERL_MODULES="$value" ;; @@ -668,7 +658,6 @@ use the \"--without-http_limit_conn_module\" option instead" --with-cc=*) CC="$value" ;; --with-cpp=*) CPP="$value" ;; - --with-link=*) LINK="$value" ;; --with-cc-opt=*) NGX_CC_OPT="$value" ;; --with-ld-opt=*) NGX_LD_OPT="$value" ;; --with-cpu-opt=*) CPU="$value" ;; @@ -775,7 +764,6 @@ cat << END --with-http_mp4_module enable ngx_http_mp4_module --with-http_gunzip_module enable ngx_http_gunzip_module --with-http_gzip_static_module enable ngx_http_gzip_static_module - --with-http_auth_request_module enable ngx_http_auth_request_module --with-http_concat_module enable ngx_http_concat_module --with-http_random_index_module enable ngx_http_random_index_module --with-http_secure_link_module enable ngx_http_secure_link_module @@ -869,8 +857,6 @@ cat << END disable ngx_http_upstream_session_sticky_module --without-http_upstream_keepalive_module disable ngx_http_upstream_keepalive_module - --without-http_upstream_dynamic_module - disable ngx_http_upstream_dynamic_module --without-http_upstream_ip_hash_module disable ngx_http_upstream_ip_hash_module --without-http_upstream_consistent_hash_module @@ -879,8 +865,6 @@ cat << END --without-http_stub_status_module disable ngx_http_stub_status_module --without-http_reqstat_module disable ngx_http_reqstat_module - --with-http_dyups_module enable ngx_http_dyups_module - --with-http_perl_module enable ngx_http_perl_module --with-perl_modules_path=PATH set Perl modules path --with-perl=PATH set perl binary pathname @@ -928,7 +912,6 @@ cat << END --with-cc=PATH set C compiler pathname --with-cpp=PATH set C preprocessor pathname - --with-link=LINK set C linker --with-cc-opt=OPTIONS set additional C compiler options --with-ld-opt=OPTIONS set additional linker options --with-cpu-opt=CPU build for the specified CPU, valid values: @@ -1092,7 +1075,6 @@ elif [ $NGX_STATIC_ALL_MODULES = YES ]; then HTTP_SLICE=YES HTTP_MP4=YES HTTP_GZIP_STATIC=YES - HTTP_GUNZIP=YES HTTP_UPSTREAM_IP_HASH=YES HTTP_FOOTER=YES HTTP_TRIM=YES @@ -1101,11 +1083,7 @@ elif [ $NGX_STATIC_ALL_MODULES = YES ]; then HTTP_UPSTREAM_LEAST_CONN=YES HTTP_UPSTREAM_SESSION_STICKY=YES HTTP_UPSTREAM_KEEPALIVE=YES - HTTP_UPSTREAM_DYNAMIC=YES - HTTP_DYNAMIC_UPSTREAM=YES HTTP_REQ_STATUS=YES - HTTP_AUTH_REQUEST=YES - MAIL=YES HTTP_XSLT_SHARED=NO HTTP_IMAGE_FILTER_SHARED=NO diff --git a/Dengine/tengine/auto/os/darwin b/Dengine/tengine/auto/os/darwin index b97518a..590e036 100644 --- a/Dengine/tengine/auto/os/darwin +++ b/Dengine/tengine/auto/os/darwin @@ -112,5 +112,5 @@ ngx_feature_incs="#include " ngx_feature_path= ngx_feature_libs= ngx_feature_test="int32_t lock, n; - n = OSAtomicCompareAndSwap32Barrier(0, 1, &lock)" + n = OSAtomicCompareAndSwap32Barrier(0, 1, lock)" . auto/feature diff --git a/Dengine/tengine/auto/os/linux b/Dengine/tengine/auto/os/linux index b303f2a..efac06c 100644 --- a/Dengine/tengine/auto/os/linux +++ b/Dengine/tengine/auto/os/linux @@ -65,41 +65,9 @@ if [ $ngx_found = yes ]; then CORE_SRCS="$CORE_SRCS $EPOLL_SRCS" EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" EVENT_FOUND=YES - - - # EPOLLRDHUP appeared in Linux 2.6.17, glibc 2.8 - - ngx_feature="EPOLLRDHUP" - ngx_feature_name="NGX_HAVE_EPOLLRDHUP" - ngx_feature_run=no - ngx_feature_incs="#include " - ngx_feature_path= - ngx_feature_libs= - ngx_feature_test="int efd = 0, fd = 0; - struct epoll_event ee; - ee.events = EPOLLIN|EPOLLRDHUP|EPOLLET; - ee.data.ptr = NULL; - epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)" - . auto/feature fi -# O_PATH and AT_EMPTY_PATH were introduced in 2.6.39, glibc 2.14 - -ngx_feature="O_PATH" -ngx_feature_name="NGX_HAVE_O_PATH" -ngx_feature_run=no -ngx_feature_incs="#include - #include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="int fd; struct stat sb; - fd = openat(AT_FDCWD, \".\", O_PATH|O_DIRECTORY|O_NOFOLLOW); - if (fstatat(fd, \"\", &sb, AT_EMPTY_PATH) != 0) return 1" -. auto/feature - - # sendfile() CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE" @@ -180,19 +148,6 @@ ngx_feature_test="struct crypt_data cd; . auto/feature -# reuseport -ngx_feature="SO_REUSEPORT" -ngx_feature_name="NGX_HAVE_REUSEPORT" -ngx_feature_run=no -ngx_feature_incs="#include - #include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_REUSEPORT, NULL, 0)" -. auto/feature - - ngx_include="sys/vfs.h"; . auto/include diff --git a/Dengine/tengine/auto/os/win32 b/Dengine/tengine/auto/os/win32 index 0b9b461..21a54ba 100644 --- a/Dengine/tengine/auto/os/win32 +++ b/Dengine/tengine/auto/os/win32 @@ -9,21 +9,10 @@ CORE_INCS="$WIN32_INCS" CORE_DEPS="$WIN32_DEPS" CORE_SRCS="$WIN32_SRCS $IOCP_SRCS" OS_CONFIG="$WIN32_CONFIG" +CORE_LIBS="$CORE_LIBS advapi32.lib ws2_32.lib" NGX_ICONS="$NGX_WIN32_ICONS" SELECT_SRCS=$WIN32_SELECT_SRCS -case "$NGX_CC_NAME" in - - gcc) - CORE_LIBS="$CORE_LIBS -ladvapi32 -lws2_32" - ;; - - *) - CORE_LIBS="$CORE_LIBS advapi32.lib ws2_32.lib" - ;; - -esac - EVENT_MODULES="$EVENT_MODULES $IOCP_MODULE" EVENT_FOUND=YES diff --git a/Dengine/tengine/auto/sources b/Dengine/tengine/auto/sources index cbf33fc..68d852d 100644 --- a/Dengine/tengine/auto/sources +++ b/Dengine/tengine/auto/sources @@ -1,3 +1,4 @@ + # Copyright (C) Igor Sysoev # Copyright (C) Nginx, Inc. @@ -37,8 +38,7 @@ CORE_DEPS="src/core/nginx.h \ src/core/ngx_conf_file.h \ src/core/ngx_resolver.h \ src/core/ngx_open_file_cache.h \ - src/core/ngx_crypt.h \ - src/core/ngx_proxy_protocol.h" + src/core/ngx_crypt.h" CORE_SRCS="src/core/nginx.c \ @@ -71,8 +71,7 @@ CORE_SRCS="src/core/nginx.c \ src/core/ngx_conf_file.c \ src/core/ngx_resolver.c \ src/core/ngx_open_file_cache.c \ - src/core/ngx_crypt.c \ - src/core/ngx_proxy_protocol.c" + src/core/ngx_crypt.c" REGEX_MODULE=ngx_regex_module @@ -357,7 +356,8 @@ HTTP_SPDY_DEPS="src/http/ngx_http_spdy.h \ src/http/ngx_http_spdy_module.h" HTTP_SPDY_SRCS="src/http/ngx_http_spdy.c \ src/http/ngx_http_spdy_module.c \ - src/http/ngx_http_spdy_filter_module.c" + src/http/ngx_http_spdy_filter_module.c \ + src/http/ngx_http_spdy_v3.c" HTTP_CHARSET_FILTER_MODULE=ngx_http_charset_filter_module @@ -422,10 +422,6 @@ HTTP_CONCAT_MODULE=ngx_http_concat_module HTTP_CONCAT_SRCS=src/http/modules/ngx_http_concat_module.c -HTTP_AUTH_REQUEST_MODULE=ngx_http_auth_request_module -HTTP_AUTH_REQUEST_SRCS=src/http/modules/ngx_http_auth_request_module.c - - HTTP_AUTOINDEX_MODULE=ngx_http_autoindex_module HTTP_AUTOINDEX_SRCS=src/http/modules/ngx_http_autoindex_module.c @@ -566,16 +562,6 @@ HTTP_UPSTREAM_KEEPALIVE_MODULE=ngx_http_upstream_keepalive_module HTTP_UPSTREAM_KEEPALIVE_SRCS=" \ src/http/modules/ngx_http_upstream_keepalive_module.c" -HTTP_UPSTREAM_DYNAMIC_MODULE=ngx_http_upstream_dynamic_module -HTTP_UPSTREAM_DYNAMIC_SRCS=" \ - src/http/modules/ngx_http_upstream_dynamic_module.c" - -HTTP_DYUPS_MODULE=ngx_http_dyups_module -HTTP_DYUPS_SRCS="src/http/modules/ngx_http_dyups_module.c" -HTTP_DYUPS_DEPS="src/http/modules/ngx_http_dyups.h" -HTTP_DYUPS_LUA_SRCS="src/http/modules/ngx_http_dyups_lua.c" -HTTP_DYUPS_LUA_DEPS="src/http/modules/ngx_http_dyups_lua.h" - HTTP_REQ_STATUS_MODULE=ngx_http_reqstat_module HTTP_REQ_STATUS_SRCS=src/http/modules/ngx_http_reqstat_module.c @@ -627,106 +613,98 @@ NGX_BACKTRACE_MODULE=ngx_backtrace_module NGX_BACKTRACE_SRCS=src/misc/ngx_backtrace_module.c NGX_HTTP_LUA_MODULE=ngx_http_lua_module -NGX_HTTP_LUA_MODULE_SRCS="modules/ngx_http_lua_module/src/ngx_http_lua_script.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_log.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_subrequest.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_ndk.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_control.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_time.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_misc.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_variable.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_string.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_output.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_headers.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_req_body.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_uri.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_args.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_ctx.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_regex.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_module.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_headers_out.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_headers_in.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_directive.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_consts.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_exception.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_util.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_cache.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_contentby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_rewriteby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_accessby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_setby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_capturefilter.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_clfactory.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_pcrefix.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_headerfilterby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_shdict.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_socket_tcp.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_api.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_logby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_sleep.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_coroutine.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_bodyfilterby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_initby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_initworkerby.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_socket_udp.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_req_method.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_phase.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_uthread.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_timer.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_config.c \ - modules/ngx_http_lua_module/src/ngx_http_lua_worker.c" +NGX_HTTP_LUA_MODULE_SRCS="src/http/modules/lua/ngx_http_lua_script.c \ + src/http/modules/lua/ngx_http_lua_log.c \ + src/http/modules/lua/ngx_http_lua_subrequest.c \ + src/http/modules/lua/ngx_http_lua_ndk.c \ + src/http/modules/lua/ngx_http_lua_control.c \ + src/http/modules/lua/ngx_http_lua_time.c \ + src/http/modules/lua/ngx_http_lua_misc.c \ + src/http/modules/lua/ngx_http_lua_variable.c \ + src/http/modules/lua/ngx_http_lua_string.c \ + src/http/modules/lua/ngx_http_lua_output.c \ + src/http/modules/lua/ngx_http_lua_headers.c \ + src/http/modules/lua/ngx_http_lua_req_body.c \ + src/http/modules/lua/ngx_http_lua_uri.c \ + src/http/modules/lua/ngx_http_lua_args.c \ + src/http/modules/lua/ngx_http_lua_ctx.c \ + src/http/modules/lua/ngx_http_lua_regex.c \ + src/http/modules/lua/ngx_http_lua_module.c \ + src/http/modules/lua/ngx_http_lua_headers_out.c \ + src/http/modules/lua/ngx_http_lua_headers_in.c \ + src/http/modules/lua/ngx_http_lua_directive.c \ + src/http/modules/lua/ngx_http_lua_consts.c \ + src/http/modules/lua/ngx_http_lua_exception.c \ + src/http/modules/lua/ngx_http_lua_util.c \ + src/http/modules/lua/ngx_http_lua_cache.c \ + src/http/modules/lua/ngx_http_lua_contentby.c \ + src/http/modules/lua/ngx_http_lua_rewriteby.c \ + src/http/modules/lua/ngx_http_lua_accessby.c \ + src/http/modules/lua/ngx_http_lua_setby.c \ + src/http/modules/lua/ngx_http_lua_capturefilter.c \ + src/http/modules/lua/ngx_http_lua_clfactory.c \ + src/http/modules/lua/ngx_http_lua_pcrefix.c \ + src/http/modules/lua/ngx_http_lua_headerfilterby.c \ + src/http/modules/lua/ngx_http_lua_shdict.c \ + src/http/modules/lua/ngx_http_lua_socket_tcp.c \ + src/http/modules/lua/ngx_http_lua_api.c \ + src/http/modules/lua/ngx_http_lua_logby.c \ + src/http/modules/lua/ngx_http_lua_sleep.c \ + src/http/modules/lua/ngx_http_lua_coroutine.c \ + src/http/modules/lua/ngx_http_lua_bodyfilterby.c \ + src/http/modules/lua/ngx_http_lua_initby.c \ + src/http/modules/lua/ngx_http_lua_socket_udp.c \ + src/http/modules/lua/ngx_http_lua_req_method.c \ + src/http/modules/lua/ngx_http_lua_phase.c \ + src/http/modules/lua/ngx_http_lua_uthread.c" -NGX_HTTP_LUA_MODULE_DEPS="modules/ngx_http_lua_module/src/ddebug.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_script.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_log.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_subrequest.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_ndk.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_control.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_time.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_string.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_misc.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_variable.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_output.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_headers.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_uri.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_req_body.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_args.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_ctx.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_regex.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_common.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_directive.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_headers_out.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_headers_in.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_consts.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_exception.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_util.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_cache.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_contentby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_rewriteby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_accessby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_setby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_capturefilter.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_clfactory.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_pcrefix.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_headerfilterby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_shdict.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_socket_tcp.h \ - modules/ngx_http_lua_module/src/api/ngx_http_lua_api.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_logby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_sleep.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_coroutine.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_bodyfilterby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_initby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_initworkerby.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_socket_udp.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_req_method.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_phase.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_probe.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_uthread.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_timer.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_config.h \ - modules/ngx_http_lua_module/src/ngx_http_lua_worker.h" +NGX_HTTP_LUA_MODULE_DEPS="src/http/modules/lua/ddebug.h \ + src/http/modules/lua/ngx_http_lua_script.h \ + src/http/modules/lua/ngx_http_lua_log.h \ + src/http/modules/lua/ngx_http_lua_subrequest.h \ + src/http/modules/lua/ngx_http_lua_ndk.h \ + src/http/modules/lua/ngx_http_lua_control.h \ + src/http/modules/lua/ngx_http_lua_time.h \ + src/http/modules/lua/ngx_http_lua_string.h \ + src/http/modules/lua/ngx_http_lua_misc.h \ + src/http/modules/lua/ngx_http_lua_variable.h \ + src/http/modules/lua/ngx_http_lua_output.h \ + src/http/modules/lua/ngx_http_lua_headers.h \ + src/http/modules/lua/ngx_http_lua_uri.h \ + src/http/modules/lua/ngx_http_lua_req_body.h \ + src/http/modules/lua/ngx_http_lua_args.h \ + src/http/modules/lua/ngx_http_lua_ctx.h \ + src/http/modules/lua/ngx_http_lua_regex.h \ + src/http/modules/lua/ngx_http_lua_common.h \ + src/http/modules/lua/ngx_http_lua_directive.h \ + src/http/modules/lua/ngx_http_lua_headers_out.h \ + src/http/modules/lua/ngx_http_lua_headers_in.h \ + src/http/modules/lua/ngx_http_lua_consts.h \ + src/http/modules/lua/ngx_http_lua_exception.h \ + src/http/modules/lua/ngx_http_lua_util.h \ + src/http/modules/lua/ngx_http_lua_cache.h \ + src/http/modules/lua/ngx_http_lua_contentby.h \ + src/http/modules/lua/ngx_http_lua_rewriteby.h \ + src/http/modules/lua/ngx_http_lua_accessby.h \ + src/http/modules/lua/ngx_http_lua_setby.h \ + src/http/modules/lua/ngx_http_lua_capturefilter.h \ + src/http/modules/lua/ngx_http_lua_clfactory.h \ + src/http/modules/lua/ngx_http_lua_pcrefix.h \ + src/http/modules/lua/ngx_http_lua_headerfilterby.h \ + src/http/modules/lua/ngx_http_lua_shdict.h \ + src/http/modules/lua/ngx_http_lua_socket_tcp.h \ + src/http/modules/lua/api/ngx_http_lua_api.h \ + src/http/modules/lua/ngx_http_lua_logby.h \ + src/http/modules/lua/ngx_http_lua_sleep.h \ + src/http/modules/lua/ngx_http_lua_coroutine.h \ + src/http/modules/lua/ngx_http_lua_bodyfilterby.h \ + src/http/modules/lua/ngx_http_lua_initby.h \ + src/http/modules/lua/ngx_http_lua_socket_udp.h \ + src/http/modules/lua/ngx_http_lua_req_method.h \ + src/http/modules/lua/ngx_http_lua_phase.h \ + src/http/modules/lua/ngx_http_lua_probe.h \ + src/http/modules/lua/ngx_http_lua_uthread.h" NGX_HTTP_TFS_MODULE="ngx_http_tfs_module" @@ -778,3 +756,5 @@ NGX_HTTP_TFS_MODULE_SRCS="src/http/modules/tfs/ngx_tfs_common.c \ src/http/modules/tfs/ngx_http_tfs_meta_server_message.c \ src/http/modules/tfs/ngx_http_tfs_peer_connection.c \ src/http/modules/tfs/ngx_http_tfs_server_handler.c " + + diff --git a/Dengine/tengine/auto/types/sizeof b/Dengine/tengine/auto/types/sizeof index 9215a54..e1d405c 100644 --- a/Dengine/tengine/auto/types/sizeof +++ b/Dengine/tengine/auto/types/sizeof @@ -45,7 +45,7 @@ if [ -x $NGX_AUTOTEST ]; then fi -rm -rf $NGX_AUTOTEST* +rm -f $NGX_AUTOTEST case $ngx_size in diff --git a/Dengine/tengine/auto/types/typedef b/Dengine/tengine/auto/types/typedef index 8b5c368..d812293 100644 --- a/Dengine/tengine/auto/types/typedef +++ b/Dengine/tengine/auto/types/typedef @@ -49,7 +49,7 @@ END fi fi - rm -rf $NGX_AUTOTEST* + rm -f $NGX_AUTOTEST if [ $ngx_found = no ]; then echo $ngx_n " $ngx_try not found$ngx_c" diff --git a/Dengine/tengine/auto/types/uintptr_t b/Dengine/tengine/auto/types/uintptr_t index f3cdccb..2f19080 100644 --- a/Dengine/tengine/auto/types/uintptr_t +++ b/Dengine/tengine/auto/types/uintptr_t @@ -33,7 +33,7 @@ else echo $ngx_n " uintptr_t not found" $ngx_c fi -rm -rf $NGX_AUTOTEST* +rm $NGX_AUTOTEST* if [ $found = no ]; then diff --git a/Dengine/tengine/auto/unix b/Dengine/tengine/auto/unix index 3d77837..844d955 100755 --- a/Dengine/tengine/auto/unix +++ b/Dengine/tengine/auto/unix @@ -370,7 +370,7 @@ ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_DEFER_ACCEPT, NULL, 0)" . auto/feature -ngx_feature="TCP_KEEPIDLE" +ngx_feature="TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT" ngx_feature_name="NGX_HAVE_KEEPALIVE_TUNABLE" ngx_feature_run=no ngx_feature_incs="#include @@ -384,18 +384,6 @@ ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_KEEPIDLE, NULL, 0); . auto/feature -ngx_feature="TCP_FASTOPEN" -ngx_feature_name="NGX_HAVE_TCP_FASTOPEN" -ngx_feature_run=no -ngx_feature_incs="#include - #include - #include " -ngx_feature_path= -ngx_feature_libs= -ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_FASTOPEN, NULL, 0)" -. auto/feature - - ngx_feature="TCP_INFO" ngx_feature_name="NGX_HAVE_TCP_INFO" ngx_feature_run=no diff --git a/Dengine/tengine/conf/mime.types b/Dengine/tengine/conf/mime.types index d146537..8c2ab35 100644 --- a/Dengine/tengine/conf/mime.types +++ b/Dengine/tengine/conf/mime.types @@ -5,7 +5,7 @@ types { text/xml xml; image/gif gif; image/jpeg jpeg jpg; - application/javascript js; + application/x-javascript js; application/atom+xml atom; application/rss+xml rss; @@ -24,17 +24,13 @@ types { image/svg+xml svg svgz; image/webp webp; - application/font-woff woff; application/java-archive jar war ear; - application/json json; application/mac-binhex40 hqx; application/msword doc; application/pdf pdf; application/postscript ps eps ai; application/rtf rtf; - application/vnd.apple.mpegurl m3u8; application/vnd.ms-excel xls; - application/vnd.ms-fontobject eot; application/vnd.ms-powerpoint ppt; application/vnd.wap.wmlc wmlc; application/vnd.google-earth.kml+xml kml; @@ -55,7 +51,6 @@ types { application/x-x509-ca-cert der pem crt; application/x-xpinstall xpi; application/xhtml+xml xhtml; - application/xspf+xml xspf; application/zip zip; application/x-nokia-widget wgz; application/vnd.android.package-archive apk; @@ -63,13 +58,10 @@ types { application/octet-stream bin exe dll; application/octet-stream deb; application/octet-stream dmg; + application/octet-stream eot; application/octet-stream iso img; application/octet-stream msi msp msm; - application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; - application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; - audio/midi mid midi kar; audio/mpeg mp3; audio/ogg ogg; @@ -77,7 +69,6 @@ types { audio/x-realaudio ra; video/3gpp 3gpp 3gp; - video/mp2t ts; video/mp4 mp4; video/mpeg mpeg mpg; video/quicktime mov; diff --git a/Dengine/tengine/conf/nginx.conf b/Dengine/tengine/conf/nginx.conf index dd9ba71..ade6d64 100644 --- a/Dengine/tengine/conf/nginx.conf +++ b/Dengine/tengine/conf/nginx.conf @@ -102,17 +102,18 @@ http { # HTTPS server # #server { - # listen 443 ssl; + # listen 443; # server_name localhost; + # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; - # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; + # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; - # ssl_prefer_server_ciphers on; + # ssl_prefer_server_ciphers on; # location / { # root html; diff --git a/Dengine/tengine/contrib/README b/Dengine/tengine/contrib/README index fec4b20..094aa52 100644 --- a/Dengine/tengine/contrib/README +++ b/Dengine/tengine/contrib/README @@ -13,9 +13,3 @@ unicode2nginx by Maxim Dounin configuration file format. Two generated full maps for windows-1251 and koi8-r. - -vim by Evan Miller - - Syntax highlighting of nginx configuration for vim, to be - placed into ~/.vim/. - diff --git a/Dengine/tengine/contrib/stylechecker.py b/Dengine/tengine/contrib/stylechecker.py index d1f3538..f29a5aa 100644 --- a/Dengine/tengine/contrib/stylechecker.py +++ b/Dengine/tengine/contrib/stylechecker.py @@ -67,25 +67,5 @@ def walk_dir(dir): for d in dirs: walk_dir(d) -def usage(): - print """ -Usage: stylechecker.py file or dir - python stylechecker.py /path/to/the/c/code - or - python stylechecker.py /file/of/c/code """ - - sys.exit(1) - -### main -if len(sys.argv) == 2: - PATH = sys.argv[1] - - if os.path.isfile(PATH): - check_file(PATH) - elif os.path.isdir(PATH): - walk_dir(PATH) - else: - print RED + "Check the %s is file or dir" % PATH + ENDC -else: - usage() +walk_dir(sys.argv[1]) diff --git a/Dengine/tengine/contrib/vim/ftdetect/nginx.vim b/Dengine/tengine/contrib/vim/ftdetect/nginx.vim deleted file mode 100644 index 3ae470d..0000000 --- a/Dengine/tengine/contrib/vim/ftdetect/nginx.vim +++ /dev/null @@ -1,4 +0,0 @@ -au BufRead,BufNewFile *.nginx set ft=nginx -au BufRead,BufNewFile */etc/nginx/* set ft=nginx -au BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx -au BufRead,BufNewFile nginx.conf set ft=nginx diff --git a/Dengine/tengine/contrib/vim/indent/nginx.vim b/Dengine/tengine/contrib/vim/indent/nginx.vim deleted file mode 100644 index 8601366..0000000 --- a/Dengine/tengine/contrib/vim/indent/nginx.vim +++ /dev/null @@ -1,11 +0,0 @@ -if exists("b:did_indent") - finish -endif -let b:did_indent = 1 - -setlocal indentexpr= - -" cindent actually works for nginx' simple file structure -setlocal cindent -" Just make sure that the comments are not reset as defs would be. -setlocal cinkeys-=0# diff --git a/Dengine/tengine/contrib/vim/syntax/nginx.vim b/Dengine/tengine/contrib/vim/syntax/nginx.vim deleted file mode 100644 index 50d809b..0000000 --- a/Dengine/tengine/contrib/vim/syntax/nginx.vim +++ /dev/null @@ -1,703 +0,0 @@ -" Vim syntax file -" Language: nginx.conf - -if exists("b:current_syntax") - finish -end - -setlocal iskeyword+=. -setlocal iskeyword+=/ -setlocal iskeyword+=: - -syn match ngxVariable '\$\(\w\+\|{\w\+}\)' -syn match ngxVariableBlock '\$\(\w\+\|{\w\+}\)' contained -syn match ngxVariableString '\$\(\w\+\|{\w\+}\)' contained -syn region ngxBlock start=+^+ end=+{+ skip=+\${+ contains=ngxComment,ngxDirectiveBlock,ngxVariableBlock,ngxString oneline -syn region ngxString start=+\z(["']\)+ end=+\z1+ skip=+\\\\\|\\\z1+ contains=ngxVariableString -syn match ngxComment ' *#.*$' - -syn keyword ngxBoolean on -syn keyword ngxBoolean off - -syn keyword ngxDirectiveBlock http contained -syn keyword ngxDirectiveBlock mail contained -syn keyword ngxDirectiveBlock events contained -syn keyword ngxDirectiveBlock server contained -syn keyword ngxDirectiveBlock types contained -syn keyword ngxDirectiveBlock location contained -syn keyword ngxDirectiveBlock upstream contained -syn keyword ngxDirectiveBlock charset_map contained -syn keyword ngxDirectiveBlock limit_except contained -syn keyword ngxDirectiveBlock if contained -syn keyword ngxDirectiveBlock geo contained -syn keyword ngxDirectiveBlock map contained - -syn keyword ngxDirectiveImportant include -syn keyword ngxDirectiveImportant root -syn keyword ngxDirectiveImportant server -syn keyword ngxDirectiveImportant server_name -syn keyword ngxDirectiveImportant listen -syn keyword ngxDirectiveImportant internal -syn keyword ngxDirectiveImportant proxy_pass -syn keyword ngxDirectiveImportant memcached_pass -syn keyword ngxDirectiveImportant fastcgi_pass -syn keyword ngxDirectiveImportant try_files - -syn keyword ngxDirectiveControl break -syn keyword ngxDirectiveControl return -syn keyword ngxDirectiveControl rewrite -syn keyword ngxDirectiveControl set - -syn keyword ngxDirectiveError error_page -syn keyword ngxDirectiveError post_action - -syn keyword ngxDirectiveDeprecated connections -syn keyword ngxDirectiveDeprecated imap -syn keyword ngxDirectiveDeprecated open_file_cache_retest -syn keyword ngxDirectiveDeprecated optimize_server_names -syn keyword ngxDirectiveDeprecated satisfy_any - -syn keyword ngxDirective accept_mutex -syn keyword ngxDirective accept_mutex_delay -syn keyword ngxDirective access_log -syn keyword ngxDirective add_after_body -syn keyword ngxDirective add_before_body -syn keyword ngxDirective add_header -syn keyword ngxDirective addition_types -syn keyword ngxDirective aio -syn keyword ngxDirective alias -syn keyword ngxDirective allow -syn keyword ngxDirective ancient_browser -syn keyword ngxDirective ancient_browser_value -syn keyword ngxDirective auth_basic -syn keyword ngxDirective auth_basic_user_file -syn keyword ngxDirective auth_http -syn keyword ngxDirective auth_http_header -syn keyword ngxDirective auth_http_timeout -syn keyword ngxDirective autoindex -syn keyword ngxDirective autoindex_exact_size -syn keyword ngxDirective autoindex_localtime -syn keyword ngxDirective charset -syn keyword ngxDirective charset_types -syn keyword ngxDirective client_body_buffer_size -syn keyword ngxDirective client_body_in_file_only -syn keyword ngxDirective client_body_in_single_buffer -syn keyword ngxDirective client_body_temp_path -syn keyword ngxDirective client_body_timeout -syn keyword ngxDirective client_header_buffer_size -syn keyword ngxDirective client_header_timeout -syn keyword ngxDirective client_max_body_size -syn keyword ngxDirective connection_pool_size -syn keyword ngxDirective create_full_put_path -syn keyword ngxDirective daemon -syn keyword ngxDirective dav_access -syn keyword ngxDirective dav_methods -syn keyword ngxDirective debug_connection -syn keyword ngxDirective debug_points -syn keyword ngxDirective default_type -syn keyword ngxDirective degradation -syn keyword ngxDirective degrade -syn keyword ngxDirective deny -syn keyword ngxDirective devpoll_changes -syn keyword ngxDirective devpoll_events -syn keyword ngxDirective directio -syn keyword ngxDirective directio_alignment -syn keyword ngxDirective empty_gif -syn keyword ngxDirective env -syn keyword ngxDirective epoll_events -syn keyword ngxDirective error_log -syn keyword ngxDirective eventport_events -syn keyword ngxDirective expires -syn keyword ngxDirective fastcgi_bind -syn keyword ngxDirective fastcgi_buffer_size -syn keyword ngxDirective fastcgi_buffers -syn keyword ngxDirective fastcgi_busy_buffers_size -syn keyword ngxDirective fastcgi_cache -syn keyword ngxDirective fastcgi_cache_key -syn keyword ngxDirective fastcgi_cache_methods -syn keyword ngxDirective fastcgi_cache_min_uses -syn keyword ngxDirective fastcgi_cache_path -syn keyword ngxDirective fastcgi_cache_use_stale -syn keyword ngxDirective fastcgi_cache_valid -syn keyword ngxDirective fastcgi_catch_stderr -syn keyword ngxDirective fastcgi_connect_timeout -syn keyword ngxDirective fastcgi_hide_header -syn keyword ngxDirective fastcgi_ignore_client_abort -syn keyword ngxDirective fastcgi_ignore_headers -syn keyword ngxDirective fastcgi_index -syn keyword ngxDirective fastcgi_intercept_errors -syn keyword ngxDirective fastcgi_max_temp_file_size -syn keyword ngxDirective fastcgi_next_upstream -syn keyword ngxDirective fastcgi_param -syn keyword ngxDirective fastcgi_pass_header -syn keyword ngxDirective fastcgi_pass_request_body -syn keyword ngxDirective fastcgi_pass_request_headers -syn keyword ngxDirective fastcgi_read_timeout -syn keyword ngxDirective fastcgi_send_lowat -syn keyword ngxDirective fastcgi_send_timeout -syn keyword ngxDirective fastcgi_split_path_info -syn keyword ngxDirective fastcgi_store -syn keyword ngxDirective fastcgi_store_access -syn keyword ngxDirective fastcgi_temp_file_write_size -syn keyword ngxDirective fastcgi_temp_path -syn keyword ngxDirective fastcgi_upstream_fail_timeout -syn keyword ngxDirective fastcgi_upstream_max_fails -syn keyword ngxDirective flv -syn keyword ngxDirective geoip_city -syn keyword ngxDirective geoip_country -syn keyword ngxDirective google_perftools_profiles -syn keyword ngxDirective gzip -syn keyword ngxDirective gzip_buffers -syn keyword ngxDirective gzip_comp_level -syn keyword ngxDirective gzip_disable -syn keyword ngxDirective gzip_hash -syn keyword ngxDirective gzip_http_version -syn keyword ngxDirective gzip_min_length -syn keyword ngxDirective gzip_no_buffer -syn keyword ngxDirective gzip_proxied -syn keyword ngxDirective gzip_static -syn keyword ngxDirective gzip_types -syn keyword ngxDirective gzip_vary -syn keyword ngxDirective gzip_window -syn keyword ngxDirective if_modified_since -syn keyword ngxDirective ignore_invalid_headers -syn keyword ngxDirective image_filter -syn keyword ngxDirective image_filter_buffer -syn keyword ngxDirective image_filter_jpeg_quality -syn keyword ngxDirective image_filter_transparency -syn keyword ngxDirective imap_auth -syn keyword ngxDirective imap_capabilities -syn keyword ngxDirective imap_client_buffer -syn keyword ngxDirective index -syn keyword ngxDirective ip_hash -syn keyword ngxDirective keepalive_requests -syn keyword ngxDirective keepalive_timeout -syn keyword ngxDirective kqueue_changes -syn keyword ngxDirective kqueue_events -syn keyword ngxDirective large_client_header_buffers -syn keyword ngxDirective limit_conn -syn keyword ngxDirective limit_conn_log_level -syn keyword ngxDirective limit_rate -syn keyword ngxDirective limit_rate_after -syn keyword ngxDirective limit_req -syn keyword ngxDirective limit_req_log_level -syn keyword ngxDirective limit_req_zone -syn keyword ngxDirective limit_zone -syn keyword ngxDirective lingering_time -syn keyword ngxDirective lingering_timeout -syn keyword ngxDirective lock_file -syn keyword ngxDirective log_format -syn keyword ngxDirective log_not_found -syn keyword ngxDirective log_subrequest -syn keyword ngxDirective map_hash_bucket_size -syn keyword ngxDirective map_hash_max_size -syn keyword ngxDirective master_process -syn keyword ngxDirective memcached_bind -syn keyword ngxDirective memcached_buffer_size -syn keyword ngxDirective memcached_connect_timeout -syn keyword ngxDirective memcached_next_upstream -syn keyword ngxDirective memcached_read_timeout -syn keyword ngxDirective memcached_send_timeout -syn keyword ngxDirective memcached_upstream_fail_timeout -syn keyword ngxDirective memcached_upstream_max_fails -syn keyword ngxDirective merge_slashes -syn keyword ngxDirective min_delete_depth -syn keyword ngxDirective modern_browser -syn keyword ngxDirective modern_browser_value -syn keyword ngxDirective msie_padding -syn keyword ngxDirective msie_refresh -syn keyword ngxDirective multi_accept -syn keyword ngxDirective open_file_cache -syn keyword ngxDirective open_file_cache_errors -syn keyword ngxDirective open_file_cache_events -syn keyword ngxDirective open_file_cache_min_uses -syn keyword ngxDirective open_file_cache_valid -syn keyword ngxDirective open_log_file_cache -syn keyword ngxDirective output_buffers -syn keyword ngxDirective override_charset -syn keyword ngxDirective perl -syn keyword ngxDirective perl_modules -syn keyword ngxDirective perl_require -syn keyword ngxDirective perl_set -syn keyword ngxDirective pid -syn keyword ngxDirective pop3_auth -syn keyword ngxDirective pop3_capabilities -syn keyword ngxDirective port_in_redirect -syn keyword ngxDirective postpone_gzipping -syn keyword ngxDirective postpone_output -syn keyword ngxDirective protocol -syn keyword ngxDirective proxy -syn keyword ngxDirective proxy_bind -syn keyword ngxDirective proxy_buffer -syn keyword ngxDirective proxy_buffer_size -syn keyword ngxDirective proxy_buffering -syn keyword ngxDirective proxy_buffers -syn keyword ngxDirective proxy_busy_buffers_size -syn keyword ngxDirective proxy_cache -syn keyword ngxDirective proxy_cache_key -syn keyword ngxDirective proxy_cache_methods -syn keyword ngxDirective proxy_cache_min_uses -syn keyword ngxDirective proxy_cache_path -syn keyword ngxDirective proxy_cache_use_stale -syn keyword ngxDirective proxy_cache_valid -syn keyword ngxDirective proxy_connect_timeout -syn keyword ngxDirective proxy_headers_hash_bucket_size -syn keyword ngxDirective proxy_headers_hash_max_size -syn keyword ngxDirective proxy_hide_header -syn keyword ngxDirective proxy_ignore_client_abort -syn keyword ngxDirective proxy_ignore_headers -syn keyword ngxDirective proxy_intercept_errors -syn keyword ngxDirective proxy_max_temp_file_size -syn keyword ngxDirective proxy_method -syn keyword ngxDirective proxy_next_upstream -syn keyword ngxDirective proxy_pass_error_message -syn keyword ngxDirective proxy_pass_header -syn keyword ngxDirective proxy_pass_request_body -syn keyword ngxDirective proxy_pass_request_headers -syn keyword ngxDirective proxy_read_timeout -syn keyword ngxDirective proxy_redirect -syn keyword ngxDirective proxy_send_lowat -syn keyword ngxDirective proxy_send_timeout -syn keyword ngxDirective proxy_set_body -syn keyword ngxDirective proxy_set_header -syn keyword ngxDirective proxy_ssl_session_reuse -syn keyword ngxDirective proxy_store -syn keyword ngxDirective proxy_store_access -syn keyword ngxDirective proxy_temp_file_write_size -syn keyword ngxDirective proxy_temp_path -syn keyword ngxDirective proxy_timeout -syn keyword ngxDirective proxy_upstream_fail_timeout -syn keyword ngxDirective proxy_upstream_max_fails -syn keyword ngxDirective random_index -syn keyword ngxDirective read_ahead -syn keyword ngxDirective real_ip_header -syn keyword ngxDirective recursive_error_pages -syn keyword ngxDirective request_pool_size -syn keyword ngxDirective reset_timedout_connection -syn keyword ngxDirective resolver -syn keyword ngxDirective resolver_timeout -syn keyword ngxDirective rewrite_log -syn keyword ngxDirective rtsig_overflow_events -syn keyword ngxDirective rtsig_overflow_test -syn keyword ngxDirective rtsig_overflow_threshold -syn keyword ngxDirective rtsig_signo -syn keyword ngxDirective satisfy -syn keyword ngxDirective secure_link_secret -syn keyword ngxDirective send_lowat -syn keyword ngxDirective send_timeout -syn keyword ngxDirective sendfile -syn keyword ngxDirective sendfile_max_chunk -syn keyword ngxDirective server_name_in_redirect -syn keyword ngxDirective server_names_hash_bucket_size -syn keyword ngxDirective server_names_hash_max_size -syn keyword ngxDirective server_tokens -syn keyword ngxDirective set_real_ip_from -syn keyword ngxDirective smtp_auth -syn keyword ngxDirective smtp_capabilities -syn keyword ngxDirective smtp_client_buffer -syn keyword ngxDirective smtp_greeting_delay -syn keyword ngxDirective so_keepalive -syn keyword ngxDirective source_charset -syn keyword ngxDirective ssi -syn keyword ngxDirective ssi_ignore_recycled_buffers -syn keyword ngxDirective ssi_min_file_chunk -syn keyword ngxDirective ssi_silent_errors -syn keyword ngxDirective ssi_types -syn keyword ngxDirective ssi_value_length -syn keyword ngxDirective ssl -syn keyword ngxDirective ssl_certificate -syn keyword ngxDirective ssl_certificate_key -syn keyword ngxDirective ssl_ciphers -syn keyword ngxDirective ssl_client_certificate -syn keyword ngxDirective ssl_crl -syn keyword ngxDirective ssl_dhparam -syn keyword ngxDirective ssl_engine -syn keyword ngxDirective ssl_prefer_server_ciphers -syn keyword ngxDirective ssl_protocols -syn keyword ngxDirective ssl_session_cache -syn keyword ngxDirective ssl_session_timeout -syn keyword ngxDirective ssl_verify_client -syn keyword ngxDirective ssl_verify_depth -syn keyword ngxDirective starttls -syn keyword ngxDirective stub_status -syn keyword ngxDirective sub_filter -syn keyword ngxDirective sub_filter_once -syn keyword ngxDirective sub_filter_types -syn keyword ngxDirective tcp_nodelay -syn keyword ngxDirective tcp_nopush -syn keyword ngxDirective thread_stack_size -syn keyword ngxDirective timeout -syn keyword ngxDirective timer_resolution -syn keyword ngxDirective types_hash_bucket_size -syn keyword ngxDirective types_hash_max_size -syn keyword ngxDirective underscores_in_headers -syn keyword ngxDirective uninitialized_variable_warn -syn keyword ngxDirective use -syn keyword ngxDirective user -syn keyword ngxDirective userid -syn keyword ngxDirective userid_domain -syn keyword ngxDirective userid_expires -syn keyword ngxDirective userid_mark -syn keyword ngxDirective userid_name -syn keyword ngxDirective userid_p3p -syn keyword ngxDirective userid_path -syn keyword ngxDirective userid_service -syn keyword ngxDirective valid_referers -syn keyword ngxDirective variables_hash_bucket_size -syn keyword ngxDirective variables_hash_max_size -syn keyword ngxDirective worker_connections -syn keyword ngxDirective worker_cpu_affinity -syn keyword ngxDirective worker_priority -syn keyword ngxDirective worker_processes -syn keyword ngxDirective worker_rlimit_core -syn keyword ngxDirective worker_rlimit_nofile -syn keyword ngxDirective worker_rlimit_sigpending -syn keyword ngxDirective worker_threads -syn keyword ngxDirective working_directory -syn keyword ngxDirective xclient -syn keyword ngxDirective xml_entities -syn keyword ngxDirective xslt_stylesheet -syn keyword ngxDirective xslt_types - -" 3rd party module list: -" http://wiki.nginx.org/Nginx3rdPartyModules - -" Accept Language Module -" Parses the Accept-Language header and gives the most suitable locale from a list of supported locales. -syn keyword ngxDirectiveThirdParty set_from_accept_language - -" Access Key Module -" Denies access unless the request URL contains an access key. -syn keyword ngxDirectiveThirdParty accesskey -syn keyword ngxDirectiveThirdParty accesskey_arg -syn keyword ngxDirectiveThirdParty accesskey_hashmethod -syn keyword ngxDirectiveThirdParty accesskey_signature - -" Auth PAM Module -" HTTP Basic Authentication using PAM. -syn keyword ngxDirectiveThirdParty auth_pam -syn keyword ngxDirectiveThirdParty auth_pam_service_name - -" Cache Purge Module -" Module adding ability to purge content from FastCGI and proxy caches. -syn keyword ngxDirectiveThirdParty fastcgi_cache_purge -syn keyword ngxDirectiveThirdParty proxy_cache_purge - -" Chunkin Module -" HTTP 1.1 chunked-encoding request body support for Nginx. -syn keyword ngxDirectiveThirdParty chunkin -syn keyword ngxDirectiveThirdParty chunkin_keepalive -syn keyword ngxDirectiveThirdParty chunkin_max_chunks_per_buf -syn keyword ngxDirectiveThirdParty chunkin_resume - -" Circle GIF Module -" Generates simple circle images with the colors and size specified in the URL. -syn keyword ngxDirectiveThirdParty circle_gif -syn keyword ngxDirectiveThirdParty circle_gif_max_radius -syn keyword ngxDirectiveThirdParty circle_gif_min_radius -syn keyword ngxDirectiveThirdParty circle_gif_step_radius - -" Drizzle Module -" Make nginx talk directly to mysql, drizzle, and sqlite3 by libdrizzle. -syn keyword ngxDirectiveThirdParty drizzle_connect_timeout -syn keyword ngxDirectiveThirdParty drizzle_dbname -syn keyword ngxDirectiveThirdParty drizzle_keepalive -syn keyword ngxDirectiveThirdParty drizzle_module_header -syn keyword ngxDirectiveThirdParty drizzle_pass -syn keyword ngxDirectiveThirdParty drizzle_query -syn keyword ngxDirectiveThirdParty drizzle_recv_cols_timeout -syn keyword ngxDirectiveThirdParty drizzle_recv_rows_timeout -syn keyword ngxDirectiveThirdParty drizzle_send_query_timeout -syn keyword ngxDirectiveThirdParty drizzle_server - -" Echo Module -" Brings 'echo', 'sleep', 'time', 'exec' and more shell-style goodies to Nginx config file. -syn keyword ngxDirectiveThirdParty echo -syn keyword ngxDirectiveThirdParty echo_after_body -syn keyword ngxDirectiveThirdParty echo_before_body -syn keyword ngxDirectiveThirdParty echo_blocking_sleep -syn keyword ngxDirectiveThirdParty echo_duplicate -syn keyword ngxDirectiveThirdParty echo_end -syn keyword ngxDirectiveThirdParty echo_exec -syn keyword ngxDirectiveThirdParty echo_flush -syn keyword ngxDirectiveThirdParty echo_foreach_split -syn keyword ngxDirectiveThirdParty echo_location -syn keyword ngxDirectiveThirdParty echo_location_async -syn keyword ngxDirectiveThirdParty echo_read_request_body -syn keyword ngxDirectiveThirdParty echo_request_body -syn keyword ngxDirectiveThirdParty echo_reset_timer -syn keyword ngxDirectiveThirdParty echo_sleep -syn keyword ngxDirectiveThirdParty echo_subrequest -syn keyword ngxDirectiveThirdParty echo_subrequest_async - -" Events Module -" Privides options for start/stop events. -syn keyword ngxDirectiveThirdParty on_start -syn keyword ngxDirectiveThirdParty on_stop - -" EY Balancer Module -" Adds a request queue to Nginx that allows the limiting of concurrent requests passed to the upstream. -syn keyword ngxDirectiveThirdParty max_connections -syn keyword ngxDirectiveThirdParty max_connections_max_queue_length -syn keyword ngxDirectiveThirdParty max_connections_queue_timeout - -" Fancy Indexes Module -" Like the built-in autoindex module, but fancier. -syn keyword ngxDirectiveThirdParty fancyindex -syn keyword ngxDirectiveThirdParty fancyindex_exact_size -syn keyword ngxDirectiveThirdParty fancyindex_footer -syn keyword ngxDirectiveThirdParty fancyindex_header -syn keyword ngxDirectiveThirdParty fancyindex_localtime -syn keyword ngxDirectiveThirdParty fancyindex_readme -syn keyword ngxDirectiveThirdParty fancyindex_readme_mode - -" GeoIP Module (DEPRECATED) -" Country code lookups via the MaxMind GeoIP API. -syn keyword ngxDirectiveThirdParty geoip_country_file - -" Headers More Module -" Set and clear input and output headers...more than "add"! -syn keyword ngxDirectiveThirdParty more_clear_headers -syn keyword ngxDirectiveThirdParty more_clear_input_headers -syn keyword ngxDirectiveThirdParty more_set_headers -syn keyword ngxDirectiveThirdParty more_set_input_headers - -" HTTP Push Module -" Turn Nginx into an adept long-polling HTTP Push (Comet) server. -syn keyword ngxDirectiveThirdParty push_buffer_size -syn keyword ngxDirectiveThirdParty push_listener -syn keyword ngxDirectiveThirdParty push_message_timeout -syn keyword ngxDirectiveThirdParty push_queue_messages -syn keyword ngxDirectiveThirdParty push_sender - -" HTTP Redis Module > -" Redis support.> -syn keyword ngxDirectiveThirdParty redis_bind -syn keyword ngxDirectiveThirdParty redis_buffer_size -syn keyword ngxDirectiveThirdParty redis_connect_timeout -syn keyword ngxDirectiveThirdParty redis_next_upstream -syn keyword ngxDirectiveThirdParty redis_pass -syn keyword ngxDirectiveThirdParty redis_read_timeout -syn keyword ngxDirectiveThirdParty redis_send_timeout - -" HTTP JavaScript Module -" Embedding SpiderMonkey. Nearly full port on Perl module. -syn keyword ngxDirectiveThirdParty js -syn keyword ngxDirectiveThirdParty js_filter -syn keyword ngxDirectiveThirdParty js_filter_types -syn keyword ngxDirectiveThirdParty js_load -syn keyword ngxDirectiveThirdParty js_maxmem -syn keyword ngxDirectiveThirdParty js_require -syn keyword ngxDirectiveThirdParty js_set -syn keyword ngxDirectiveThirdParty js_utf8 - -" Log Request Speed -" Log the time it took to process each request. -syn keyword ngxDirectiveThirdParty log_request_speed_filter -syn keyword ngxDirectiveThirdParty log_request_speed_filter_timeout - -" Memc Module -" An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands. -syn keyword ngxDirectiveThirdParty memc_buffer_size -syn keyword ngxDirectiveThirdParty memc_cmds_allowed -syn keyword ngxDirectiveThirdParty memc_connect_timeout -syn keyword ngxDirectiveThirdParty memc_flags_to_last_modified -syn keyword ngxDirectiveThirdParty memc_next_upstream -syn keyword ngxDirectiveThirdParty memc_pass -syn keyword ngxDirectiveThirdParty memc_read_timeout -syn keyword ngxDirectiveThirdParty memc_send_timeout -syn keyword ngxDirectiveThirdParty memc_upstream_fail_timeout -syn keyword ngxDirectiveThirdParty memc_upstream_max_fails - -" Mogilefs Module -" Implements a MogileFS client, provides a replace to the Perlbal reverse proxy of the original MogileFS. -syn keyword ngxDirectiveThirdParty mogilefs_connect_timeout -syn keyword ngxDirectiveThirdParty mogilefs_domain -syn keyword ngxDirectiveThirdParty mogilefs_methods -syn keyword ngxDirectiveThirdParty mogilefs_noverify -syn keyword ngxDirectiveThirdParty mogilefs_pass -syn keyword ngxDirectiveThirdParty mogilefs_read_timeout -syn keyword ngxDirectiveThirdParty mogilefs_send_timeout -syn keyword ngxDirectiveThirdParty mogilefs_tracker - -" MP4 Streaming Lite Module -" Will seek to a certain time within H.264/MP4 files when provided with a 'start' parameter in the URL. -syn keyword ngxDirectiveThirdParty mp4 - -" Nginx Notice Module -" Serve static file to POST requests. -syn keyword ngxDirectiveThirdParty notice -syn keyword ngxDirectiveThirdParty notice_type - -" Phusion Passenger -" Easy and robust deployment of Ruby on Rails application on Apache and Nginx webservers. -syn keyword ngxDirectiveThirdParty passenger_base_uri -syn keyword ngxDirectiveThirdParty passenger_default_user -syn keyword ngxDirectiveThirdParty passenger_enabled -syn keyword ngxDirectiveThirdParty passenger_log_level -syn keyword ngxDirectiveThirdParty passenger_max_instances_per_app -syn keyword ngxDirectiveThirdParty passenger_max_pool_size -syn keyword ngxDirectiveThirdParty passenger_pool_idle_time -syn keyword ngxDirectiveThirdParty passenger_root -syn keyword ngxDirectiveThirdParty passenger_ruby -syn keyword ngxDirectiveThirdParty passenger_use_global_queue -syn keyword ngxDirectiveThirdParty passenger_user_switching -syn keyword ngxDirectiveThirdParty rack_env -syn keyword ngxDirectiveThirdParty rails_app_spawner_idle_time -syn keyword ngxDirectiveThirdParty rails_env -syn keyword ngxDirectiveThirdParty rails_framework_spawner_idle_time -syn keyword ngxDirectiveThirdParty rails_spawn_method - -" RDS JSON Module -" Help ngx_drizzle and other DBD modules emit JSON data. -syn keyword ngxDirectiveThirdParty rds_json -syn keyword ngxDirectiveThirdParty rds_json_content_type -syn keyword ngxDirectiveThirdParty rds_json_format -syn keyword ngxDirectiveThirdParty rds_json_ret - -" RRD Graph Module -" This module provides an HTTP interface to RRDtool's graphing facilities. -syn keyword ngxDirectiveThirdParty rrd_graph -syn keyword ngxDirectiveThirdParty rrd_graph_root - -" Secure Download -" Create expiring links. -syn keyword ngxDirectiveThirdParty secure_download -syn keyword ngxDirectiveThirdParty secure_download_fail_location -syn keyword ngxDirectiveThirdParty secure_download_path_mode -syn keyword ngxDirectiveThirdParty secure_download_secret - -" SlowFS Cache Module -" Module adding ability to cache static files. -syn keyword ngxDirectiveThirdParty slowfs_big_file_size -syn keyword ngxDirectiveThirdParty slowfs_cache -syn keyword ngxDirectiveThirdParty slowfs_cache_key -syn keyword ngxDirectiveThirdParty slowfs_cache_min_uses -syn keyword ngxDirectiveThirdParty slowfs_cache_path -syn keyword ngxDirectiveThirdParty slowfs_cache_purge -syn keyword ngxDirectiveThirdParty slowfs_cache_valid -syn keyword ngxDirectiveThirdParty slowfs_temp_path - -" Strip Module -" Whitespace remover. -syn keyword ngxDirectiveThirdParty strip - -" Substitutions Module -" A filter module which can do both regular expression and fixed string substitutions on response bodies. -syn keyword ngxDirectiveThirdParty subs_filter -syn keyword ngxDirectiveThirdParty subs_filter_types - -" Supervisord Module -" Module providing nginx with API to communicate with supervisord and manage (start/stop) backends on-demand. -syn keyword ngxDirectiveThirdParty supervisord -syn keyword ngxDirectiveThirdParty supervisord_inherit_backend_status -syn keyword ngxDirectiveThirdParty supervisord_name -syn keyword ngxDirectiveThirdParty supervisord_start -syn keyword ngxDirectiveThirdParty supervisord_stop - -" Upload Module -" Parses multipart/form-data allowing arbitrary handling of uploaded files. -syn keyword ngxDirectiveThirdParty upload_aggregate_form_field -syn keyword ngxDirectiveThirdParty upload_buffer_size -syn keyword ngxDirectiveThirdParty upload_cleanup -syn keyword ngxDirectiveThirdParty upload_limit_rate -syn keyword ngxDirectiveThirdParty upload_max_file_size -syn keyword ngxDirectiveThirdParty upload_max_output_body_len -syn keyword ngxDirectiveThirdParty upload_max_part_header_len -syn keyword ngxDirectiveThirdParty upload_pass -syn keyword ngxDirectiveThirdParty upload_pass_args -syn keyword ngxDirectiveThirdParty upload_pass_form_field -syn keyword ngxDirectiveThirdParty upload_set_form_field -syn keyword ngxDirectiveThirdParty upload_store -syn keyword ngxDirectiveThirdParty upload_store_access - -" Upload Progress Module -" Tracks and reports upload progress. -syn keyword ngxDirectiveThirdParty report_uploads -syn keyword ngxDirectiveThirdParty track_uploads -syn keyword ngxDirectiveThirdParty upload_progress -syn keyword ngxDirectiveThirdParty upload_progress_content_type -syn keyword ngxDirectiveThirdParty upload_progress_header -syn keyword ngxDirectiveThirdParty upload_progress_json_output -syn keyword ngxDirectiveThirdParty upload_progress_template - -" Upstream Fair Balancer -" Sends an incoming request to the least-busy backend server, rather than distributing requests round-robin. -syn keyword ngxDirectiveThirdParty fair -syn keyword ngxDirectiveThirdParty upstream_fair_shm_size - -" Upstream Consistent Hash -" Select backend based on Consistent hash ring. -syn keyword ngxDirectiveThirdParty consistent_hash - -" Upstream Hash Module -" Provides simple upstream load distribution by hashing a configurable variable. -syn keyword ngxDirectiveThirdParty hash -syn keyword ngxDirectiveThirdParty hash_again - -" XSS Module -" Native support for cross-site scripting (XSS) in an nginx. -syn keyword ngxDirectiveThirdParty xss_callback_arg -syn keyword ngxDirectiveThirdParty xss_get -syn keyword ngxDirectiveThirdParty xss_input_types -syn keyword ngxDirectiveThirdParty xss_output_type - -" uWSGI Module -" Allows Nginx to interact with uWSGI processes and control what parameters are passed to the process. -syn keyword ngxDirectiveThirdParty uwsgi_bind -syn keyword ngxDirectiveThirdParty uwsgi_buffer_size -syn keyword ngxDirectiveThirdParty uwsgi_buffering -syn keyword ngxDirectiveThirdParty uwsgi_buffers -syn keyword ngxDirectiveThirdParty uwsgi_busy_buffers_size -syn keyword ngxDirectiveThirdParty uwsgi_cache -syn keyword ngxDirectiveThirdParty uwsgi_cache_bypass -syn keyword ngxDirectiveThirdParty uwsgi_cache_key -syn keyword ngxDirectiveThirdParty uwsgi_cache_lock -syn keyword ngxDirectiveThirdParty uwsgi_cache_lock_timeout -syn keyword ngxDirectiveThirdParty uwsgi_cache_methods -syn keyword ngxDirectiveThirdParty uwsgi_cache_min_uses -syn keyword ngxDirectiveThirdParty uwsgi_cache_path -syn keyword ngxDirectiveThirdParty uwsgi_cache_use_stale -syn keyword ngxDirectiveThirdParty uwsgi_cache_valid -syn keyword ngxDirectiveThirdParty uwsgi_connect_timeout -syn keyword ngxDirectiveThirdParty uwsgi_hide_header -syn keyword ngxDirectiveThirdParty uwsgi_ignore_client_abort -syn keyword ngxDirectiveThirdParty uwsgi_ignore_headers -syn keyword ngxDirectiveThirdParty uwsgi_intercept_errors -syn keyword ngxDirectiveThirdParty uwsgi_max_temp_file_size -syn keyword ngxDirectiveThirdParty uwsgi_modifier1 -syn keyword ngxDirectiveThirdParty uwsgi_modifier2 -syn keyword ngxDirectiveThirdParty uwsgi_next_upstream -syn keyword ngxDirectiveThirdParty uwsgi_no_cache -syn keyword ngxDirectiveThirdParty uwsgi_param -syn keyword ngxDirectiveThirdParty uwsgi_pass -syn keyword ngxDirectiveThirdParty uwsgi_pass_header -syn keyword ngxDirectiveThirdParty uwsgi_pass_request_body -syn keyword ngxDirectiveThirdParty uwsgi_pass_request_headers -syn keyword ngxDirectiveThirdParty uwsgi_read_timeout -syn keyword ngxDirectiveThirdParty uwsgi_send_timeout -syn keyword ngxDirectiveThirdParty uwsgi_store -syn keyword ngxDirectiveThirdParty uwsgi_store_access -syn keyword ngxDirectiveThirdParty uwsgi_string -syn keyword ngxDirectiveThirdParty uwsgi_temp_file_write_size -syn keyword ngxDirectiveThirdParty uwsgi_temp_path - -" highlight - -hi link ngxComment Comment -hi link ngxVariable Identifier -hi link ngxVariableBlock Identifier -hi link ngxVariableString PreProc -hi link ngxBlock Normal -hi link ngxString String - -hi link ngxBoolean Boolean -hi link ngxDirectiveBlock Statement -hi link ngxDirectiveImportant Type -hi link ngxDirectiveControl Keyword -hi link ngxDirectiveError Constant -hi link ngxDirectiveDeprecated Error -hi link ngxDirective Identifier -hi link ngxDirectiveThirdParty Special - -let b:current_syntax = "nginx" diff --git a/Dengine/tengine/docs/modules/ngx_http_concat_cn.md b/Dengine/tengine/docs/modules/ngx_http_concat_cn.md index a5d6bd7..fac0a62 100644 --- a/Dengine/tengine/docs/modules/ngx_http_concat_cn.md +++ b/Dengine/tengine/docs/modules/ngx_http_concat_cn.md @@ -39,11 +39,11 @@ **concat_types** `MIME types` -**默认:** `concat_types: application/x-javascript text/css` +**默认:** `concat_types: text/css application/x-javascript` **上下文:** `http, server, location` -定义配置的[MIME types](http://en.wikipedia.org/wiki/MIME_type)以及 "application/x-javascript" 是可以被接受 +定义哪些[MIME types](http://en.wikipedia.org/wiki/MIME_type)是可以被接受

diff --git a/Dengine/tengine/docs/modules/ngx_http_core_module.md b/Dengine/tengine/docs/modules/ngx_http_core_module.md index e0f6e76..622da10 100644 --- a/Dengine/tengine/docs/modules/ngx_http_core_module.md +++ b/Dengine/tengine/docs/modules/ngx_http_core_module.md @@ -53,12 +53,3 @@ Context: `http, server, location` The same as `proxy_request_buffering`. -## gzip\_clear\_etag ## - -Syntax: **gzip\_clear\_etag** `on | off` - -Default: `on` - -Context: `http, server, location` - -Determines whether gzip module should clear the “ETag” response header field. diff --git a/Dengine/tengine/docs/modules/ngx_http_core_module_cn.md b/Dengine/tengine/docs/modules/ngx_http_core_module_cn.md index cdf4df2..42e80f8 100644 --- a/Dengine/tengine/docs/modules/ngx_http_core_module_cn.md +++ b/Dengine/tengine/docs/modules/ngx_http_core_module_cn.md @@ -53,13 +53,3 @@ Context: `http, server, location` 用法跟`proxy_request_buffering`指令一样。 -## gzip\_clear\_etag ## - -Syntax: **gzip\_clear\_etag** `on | off` - -Default: `on` - -Context: `http, server, location` - -压缩的时候是否删除"ETag"响应头。 - diff --git a/Dengine/tengine/docs/modules/ngx_http_dyups_module.md b/Dengine/tengine/docs/modules/ngx_http_dyups_module.md deleted file mode 100644 index c2fdc3f..0000000 --- a/Dengine/tengine/docs/modules/ngx_http_dyups_module.md +++ /dev/null @@ -1,250 +0,0 @@ -Name -==== - -* ngx_http_dyups_module - -Description -=========== - -This module can be used to update your upstream-list without reloadding Nginx. - -TODO: - -It can not work with common `nginx_upstream_check_module`. - - -Compilation -=========== - -The module is not compiled into Tengine by default. It can be enabled with '--with-http_dyups_module' -configuration parameter, and enabled lua support with '--with-http_dyups_lua_api'. -But it can not be compiled as a '.so'. - -Example -========== - -file: conf/nginx.conf - - daemon off; - error_log logs/error.log debug; - - events { - } - - http { - - dyups_upstream_conf conf/upstream.conf; - - include conf/upstream.conf; - - server { - listen 8080; - - location / { - proxy_pass http://$host; - } - } - - server { - listen 8088; - location / { - echo 8088; - } - } - - server { - listen 8089; - location / { - echo 8089; - } - } - - server { - listen 8081; - location / { - dyups_interface; - } - } - } - - -file: conf/upstream.conf - - upstream host1 { - server 127.0.0.1:8088; - } - - upstream host2 { - server 127.0.0.1:8089; - } - - -Directives -=========== - -dyups_interface --------------------------- - -**Syntax**: *dyups_interface* - -**Default**: *none* - -**Context**: *loc* - -This directive set the interface location where you can add or delete the upstream list. See the section of Interface for detail. - -dyups_read_msg_timeout ------------------------------ - -**Syntax**: *dyups_read_msg_timeout time* - -**Default**: *1s* - -**Context**: *main* - -This directive set the interval of workers readding the commands from share memory. - -dyups_shm_zone_size ------------------------------ - -**Syntax**: *dyups_shm_zone_size size* - -**Default**: *2M* - -**Context**: *main* - -This directive set the size of share memory which used to store the commands. - -dyups_upstream_conf ------------------------------ - -**Syntax**: *dyups_upstream_conf path* - -**Default**: *none* - -**Context**: *main* - -This directive set the path of file which you dumped all of upstreams' configs, it will be loaded in `init process` after process respwan to restore upstreams. - -dyups_trylock ------------------------------ - -**Syntax**: *dyups_trylock on | off* - -**Default**: *off* - -**Context**: *main* - -You will get a better prefomance but it maybe not stable, and you will get a '409' when the update request conflicts with others. - - -restful interface -======================== - -GET -------------------- - -* `/detail` get all upstreams and their servers -* `/list` get the list of upstreams -* `/upstream/name` find the upstream by it's name - -POST -------------------- - -* `/upstream/name` update one upstream -* `body` commands; -* `body` server ip:port; - -DELETE -------------------- -* `/upstream/name` delete one upstream - -Call the interface, when you get the return code is `HTTP_INTERNAL_SERVER_ERROR 500`, you need to reload nginx to make the Nginx work at a good state. - -If you got `HTTP_CONFLICT 409`, you need resend the same commands again latter. - -The /list and /detail interface will return `HTTP_NO_CONTENT 204` when there is no upstream. - -Other code means you should modify your commands and call the interface again. - -`ATTENEION`: You also need a `third-party` to generate the new config and dump it to Nginx'conf directory. - -Sample -------------------- -```bash -» curl -H "host: dyhost" 127.0.0.1:8080 - -502 Bad Gateway - -

502 Bad Gateway

-
nginx/1.3.13
- - - -» curl -d "server 127.0.0.1:8089;server 127.0.0.1:8088;" 127.0.0.1:8081/upstream/dyhost -success - -» curl -H "host: dyhost" 127.0.0.1:8080 -8089 - -» curl -H "host: dyhost" 127.0.0.1:8080 -8088 - -» curl 127.0.0.1:8081/detail -host1 -server 127.0.0.1:8088 - -host2 -server 127.0.0.1:8089 - -dyhost -server 127.0.0.1:8089 -server 127.0.0.1:8088 - -» curl -i -X DELETE 127.0.0.1:8081/upstream/dyhost -success - -» curl 127.0.0.1:8081/detail -host1 -server 127.0.0.1:8088 - -host2 -server 127.0.0.1:8089 -``` - -API -======================== - -```c -extern ngx_flag_t ngx_http_dyups_api_enable; -ngx_int_t ngx_dyups_update_upstream(ngx_str_t *name, ngx_buf_t *buf, - ngx_str_t *rv); -ngx_int_t ngx_dyups_delete_upstream(ngx_str_t *name, ngx_str_t *rv); -``` - -## Lua API Example - -NOTICE: - you should add the directive `dyups_interface` into your config file to active this feature - -```lua -content_by_lua ' - local dyups = require "ngx.dyups" - - local status, rv = dyups.update("test", [[server 127.0.0.1:8088;]]); - ngx.print(status, rv) - if status ~= 200 then - ngx.print(status, rv) - return - end - ngx.print("update success") - - status, rv = dyups.delete("test") - if status ~= 200 then - ngx.print(status, rv) - return - end - ngx.print("delete success") -'; - -``` diff --git a/Dengine/tengine/docs/modules/ngx_http_reqstat_module.md b/Dengine/tengine/docs/modules/ngx_http_reqstat_module.md index 487b43e..3e1ee7b 100644 --- a/Dengine/tengine/docs/modules/ngx_http_reqstat_module.md +++ b/Dengine/tengine/docs/modules/ngx_http_reqstat_module.md @@ -13,14 +13,10 @@ This module will help monitor running status of Tengine. * The information is divided into different zones, and each zone is independent. * The status information is about connections, requests, response status codes, input and output flows, - rt, upstreams, and so on. + rt, and upstreams. * It shows all the results by default, and can be set to show part of them by specifying zones. -* It support for user-defined status by using nginx variables. The maximum of all the status is 50. - -* It recycles out-of-date running status information. - Compilation =========== @@ -51,9 +47,9 @@ Example * Line format: - kv,bytes_in_total,bytes_out_total,conn_total,req_total,2xx,3xx,4xx,5xx,other,rt_total,upstream_req,upstream_rt,upstream_tries,200,206,302,304,403,404,416,499,500,502,503,504,508,detail_other,ups_4xx,ups_5xx + kv,bytes_in_total,bytes_out_total,conn_total,req_total,2xx,3xx,4xx,5xx,other,rt_total,upstream_req,upstream_rt,upstream_tries - * **kv** value of the variable defined by the directive 'req_status_zone'. The maximun key length is configurable, 104B by default, and overlength will be cut off + * **kv** value of the variable defined by the directive 'req_status_zone' * **bytes_in_total** total number of bytes received from client * **bytes_out_total** total number of bytes sent to client * **conn_total** total number of accepted connections @@ -67,24 +63,6 @@ Example * **upstream_req** total number of requests calling for upstream * **upstream_rt** accumulation or upstream rt * **upstream_tries** total number of times calling for upstream - * **200** total number of 200 requests - * **206** total number of 206 requests - * **302** total number of 302 requests - * **304** total number of 304 requests - * **403** total number of 403 requests - * **404** total number of 404 requests - * **416** total number of 416 requests - * **499** total number of 499 requests - * **500** total number of 500 requests - * **502** total number of 502 requests - * **503** total number of 503 requests - * **504** total number of 504 requests - * **508** total number of 508 requests - * **detail_other** total number of requests of other status codes - * **ups_4xx** total number of requests of upstream 4xx - * **ups_5xx** total number of requests of upstream 5xx - - * some fields will be removed in future, because user-defined status has been supported. * tsar can parse the result and monitor, see also https://github.com/alibaba/tsar @@ -134,41 +112,3 @@ req_status_show **Context**: *loc* Display the status information. You can specify zones to display. - - -req_status_zone_add_indicator --------------------------------- - -**Syntax**: *req_status_zone_add_indecator zone_name $var1 [$var2 [...]]* - -**Default**: *none* - -**Context**: *main* - -Add user-defined status by using nginx variables. The status will be appended at the end of each line on display. - - -req_status_zone_key_length -------------------------------- - -**Syntax**: *req_status_zone_key_length zone_name length* - -**Default**: *none* - -**Context**: *main* - -Define the maximun length of key for a zone. The default is 104. - - -req_status_zone_recycle -------------------------------- - -**Syntax**: *req_status_zone_recycle zone_name times seconds* - -**Default**: *none* - -**Context**: *main* - -Define the recycle threshold for a zone. Recycle will be switched on when the shared memory is exhausted, and will only take effect on imformation whose visit frequency is lower than the setting. -The setting frequency is defined by 'times' and 'seconds', and it is 10r/min by default. - req_status_zone_recycle demo_zone 10 60; diff --git a/Dengine/tengine/docs/modules/ngx_http_reqstat_module_cn.md b/Dengine/tengine/docs/modules/ngx_http_reqstat_module_cn.md index ed1faee..5d4fa6c 100644 --- a/Dengine/tengine/docs/modules/ngx_http_reqstat_module_cn.md +++ b/Dengine/tengine/docs/modules/ngx_http_reqstat_module_cn.md @@ -8,14 +8,10 @@ * 这个模块计算定义的变量,根据变量值分别统计Tengine的运行状况。 -* 可以监视的运行状况有:连接数、请求数、各种响应码范围的请求数、输入输出流量、rt、upstream访问等。 +* 可以监视的运行状况有:连接数、请求数、各种响应码范围的请求数、输入输出流量、rt、upstream访问。 * 可以指定获取所有监控结果或者一部分监控结果。 -* 利用变量添加自定义监控状态。总的监控状态最大个数为50个。 - -* 回收过期的监控数据。 - 编译 =========== @@ -43,9 +39,9 @@ * 每行的格式 - kv,bytes_in_total,bytes_out_total,conn_total,req_total,2xx,3xx,4xx,5xx,other,rt_total,upstream_req,upstream_rt,upstream_tries,200,206,302,304,403,404,416,499,500,502,503,504,508,detail_other,ups_4xx,ups_5xx + kv,bytes_in_total,bytes_out_total,conn_total,req_total,2xx,3xx,4xx,5xx,other,rt_total - * kv 计算得到的req_status_zone指令定义变量的值,最大长度可配置,默认104B,超长的部分截断 + * kv 计算得到的req_status_zone指令定义变量的值 * bytes_in_total 从客户端接收流量总和 * bytes_out_total 发送到客户端流量总和 * conn_total 处理过的连接总数 @@ -59,24 +55,6 @@ * upstream_req 需要访问upstream的请求总数 * upstream_rt 访问upstream的总rt * upstream_tries upstram总访问次数 - * 200 200请求的总数 - * 206 206请求的总数 - * 302 302请求的总数 - * 304 304请求的总数 - * 403 403请求的总数 - * 404 404请求的总数 - * 416 416请求的总数 - * 499 499请求的总数 - * 500 500请求的总数 - * 502 502请求的总数 - * 503 503请求的总数 - * 504 504请求的总数 - * 508 508请求的总数 - * detail_other 非以上13种status code的请求总数 - * ups_4xx upstream返回4xx响应的请求总数 - * ups_5xx upstream返回5xx响应的请求总数 - - * 注,后续会清理这些状态,因为已经支持了自定义状态。 * tsar可解析输出结果,具体见https://github.com/alibaba/tsar @@ -125,41 +103,3 @@ req_status_show **Context**: *loc* 按格式返回统计结果。可指定返回部分目标的统计结果。 - - -req_status_zone_add_indicator --------------------------------- - -**Syntax**: *req_status_zone_add_indecator zone_name $var1 [$var2 [...]]* - -**Default**: *none* - -**Context**: *main* - -通过变量增加自定义字段,新增加的字段目前会展现在每行的末尾。 - - -req_status_zone_key_length -------------------------------- - -**Syntax**: *req_status_zone_key_length zone_name length* - -**Default**: *none* - -**Context**: *main* - -定义某个共享内存块中key的最大长度,默认值104。key中超出的部分会被截断。 - - -req_status_zone_recycle -------------------------------- - -**Syntax**: *req_status_zone_recycle zone_name times seconds* - -**Default**: *none* - -**Context**: *main* - -定义某个共享内存块过期数据的回收。回收在共享内存耗尽时自动开启。只会回收访问频率低于设置值的监控数据。 -频率定义为 times / seconds,默认值为10r/min,即 - req_status_zone_recycle demo_zone 10 60; diff --git a/Dengine/tengine/docs/modules/ngx_http_spdy_module.md b/Dengine/tengine/docs/modules/ngx_http_spdy_module.md index 3f74934..e8a5964 100644 --- a/Dengine/tengine/docs/modules/ngx_http_spdy_module.md +++ b/Dengine/tengine/docs/modules/ngx_http_spdy_module.md @@ -1,10 +1,5 @@ # Name # -**NOTE** -1. This module has been updated to official nginx SPDY/3.1 module, the document is available here: - http://nginx.org/en/docs/http/ngx_http_spdy_module.html -2. This document only applies to Tengine-2.1.0 and its old version. But the listen option `spdy_detect` can still be used with SPDY/3.1. - **ngx\_http\_spdy\_module** Tengine added SPDY/3 support to this module. The new directives are listed below. diff --git a/Dengine/tengine/docs/modules/ngx_http_spdy_module_cn.md b/Dengine/tengine/docs/modules/ngx_http_spdy_module_cn.md index f34e0f4..45df801 100644 --- a/Dengine/tengine/docs/modules/ngx_http_spdy_module_cn.md +++ b/Dengine/tengine/docs/modules/ngx_http_spdy_module_cn.md @@ -1,10 +1,5 @@ # Name # -**注意** -1. Tengine-2.1.0以上版本的SPDY模块已经与官方nginx同步,只支持SPDY/3.1。 - 文档参考: http://nginx.org/en/docs/http/ngx_http_SPDY_module.html -2. 以下文档只适用于Tengine-2.1.0及以下版本,只支持SPDY/2和SPDY/3。listen参数`spdy_detect`在SPDY/3.1下任然可以使用。 - **ngx\_http\_spdy\_module** Tengine对SPDY模块增加SPDY/3协议的支持。以下是新增的指令。 diff --git a/Dengine/tengine/docs/modules/ngx_http_sysguard.md b/Dengine/tengine/docs/modules/ngx_http_sysguard.md deleted file mode 100644 index 8fff374..0000000 --- a/Dengine/tengine/docs/modules/ngx_http_sysguard.md +++ /dev/null @@ -1,127 +0,0 @@ -# ngx_http_sysguard_module - -## Description - -This module monitors memory usage (including the swap partition), load of CPUs and average response time of requests of the system. If any guideline that is monitored exceeds the threshold set by user, the current request will be redirected to a specific url. To be clarified, this module can only be full functional when the system supports sysinfo function and loadavg function. The sysguard module also need to read memory information from /proc file system. - -## Configuration - - server { - sysguard on; - sysguard_mode or; - - sysguard_load load=10.5 action=/loadlimit; - sysguard_mem swapratio=20% action=/swaplimit; - sysguard_mem free=100M action=/freelimit; - sysguard_rt rt=0.01 period=5s action=/rtlimit; - - location /loadlimit { - return 503; - } - - location /swaplimit { - return 503; - } - - location /freelimit { - return 503; - } - - location /rtlimit { - return 503; - } - } - -## Directives - -**sysguard** `on` | `off` - -**Default:** `sysguard off` - -**Context:** `http, server, location` - -Enable or disable the sysguard module. - -
-
- -**sysguard_load** `load=[ncpu*]number [action=/url]` - -**Default:** `none` - -**Context:** `http, server, location` - -This directive tells the module to protect the system by monitoring the load of CPUs. If the system's loads reach the value that is specified by 'number' in one minute, the incoming request will be redirected to the url specified by 'action' parameter. If 'action' is not specified, tengine will respond with 503 error directly. It's also possible to use ncpu\* to make the configuration, in which case, ncpu stands for the number of the CPU cores. For instance, load = ncpu*1.5. - -
-
- -**sysguard_mem** `[swapratio=ratio%] [free=size] [action=/url]` - -**Default:** `-` - -**Context:** `http, server, location` - -This directive is used to tell the module to protect the system by monitoring memroy usage. 'swapratio' is used to specify how many percent of the swap partition of the system, and 'free' is used to specify the miminum size of current memory. If any condition is fulfilled, the incoming request will be redirected to specified url, which is defined by parameter 'action'. If 'action' is not specified, the request will be responded with 503 error directly. Besides, if the user disables the swap partition in the system, this directive will not be functional. 'free' is calculated by /proc/meminfo, the algorithm is 'memfree = free + buffered + cached'. - -
-
- -**sysguard_rt** `[rt=seconds] [period=time] [action=/url]` - -**Default:** `-` - -**Context:** `http, server, location` - -This directive is used to tell the module to protect the system by monitoring average response time of requests in a specified period. Parameter rt is used to set a threshold of the average response time, in second. Parameter period is used to specifiy the period of the statistics cycle. If the average response time of the system exceeds the threshold specified by the user, the incoming request will be redirected to a specified url which is defined by parameter 'action'. If no 'action' is presented, the request will be responded with 503 error directly. - -
-
- -**sysguard_mode** `and` | `or` - -**Default:** 'sysguard_mode or' - -**Context** 'http, server, location' - -If there are more than one type of monitor, this directive is used to specified the relations among all the monitors which are: 'and' for all matching and 'or' for any matching. - -
-
- -**sysguard_interval** 'time' - -**Default** 'sysguard_interval 1s' - -**Context** 'http, server, location' - -Specify the time interval to update your system information. - -
-
- -**sysguard_log_level** '[info | notice | warn | error]' - -**Default** 'sysguard_log_level error' - -**Context** 'http, server, location' - -Specify the log level of sysguard. - -## Installation - - 1. Compile sysguard module - - configure [--with-http_sysguard_module | --with-http_sysguard_module=shared] - - --with-http_sysguard_module, sysguard module will be compiled statically into tengine. - - --with-http_sysguard_module=shared, sysguard module will be compiled dynamically into tengine. - - 2. Build and install - - make&make install - - 3. Make sysguard configuration - - 4. Run diff --git a/Dengine/tengine/docs/modules/ngx_http_sysguard_cn.md b/Dengine/tengine/docs/modules/ngx_http_sysguard_cn.md deleted file mode 100644 index 91eddbf..0000000 --- a/Dengine/tengine/docs/modules/ngx_http_sysguard_cn.md +++ /dev/null @@ -1,127 +0,0 @@ -# sysguard 模块 - -## 介绍 - -该模块监控内存(含swap分区)、CPU和请求的响应时间,当某些监控指标达到设定的阈值时,跳转到指定的url。注意,目前该模块仅对系统支持sysinfo函数时,才支持基于load与内存信息的保护,以及系统支持loadavg函数时支持基于load进行保护。模块需要从/proc文件系统中读取内存信息。 - -## 配置 - - server { - sysguard on; - sysguard_mode or; - - sysguard_load load=10.5 action=/loadlimit; - sysguard_mem swapratio=20% action=/swaplimit; - sysguard_mem free=100M action=/freelimit; - sysguard_rt rt=0.01 period=5s action=/rtlimit; - - location /loadlimit { - return 503; - } - - location /swaplimit { - return 503; - } - - location /freelimit { - return 503; - } - - location /rtlimit { - return 503; - } - } - -## 指令 - -**sysguard** `on` | `off` - -**默认:** `sysguard off` - -**上下文:** `http, server, location` - -打开或者关闭这个模块 - -
-
- -**sysguard_load** `load=[ncpu*]number [action=/url]` - -**默认:** `none` - -**上下文:** `http, server, location` - -该指令用于配置根据系统的load来限制用户的请求,以保护系统。当系统在一分钟内的load达到number时,将进来的请求转到action所指定的url。如果action没有配置,则直接返回503错误。load的数值还支持使用ncpu\*系数的方式来配置,ncpu表示cpu核数,乘以固定的系数得出期望限制的load值,如: load=ncpu\*1.5。 - -
-
- -**sysguard_mem** `[swapratio=ratio%] [free=size] [action=/url]` - -**默认:** `-` - -**上下文:** `http, server, location` - -该指令用于配置根据系统的内存使用状态来限制用户请求,以保护系统。swapratio用于配置当当前交换空间的已使用ratio%时,或者剩下的内存少于size时,就将进来的请求跳转到指定的url。如果action没有配置,则直接返回503错误。另外,如果用户自己禁用了交换区间,则配置该指定是不起作用的。free是根据/proc/meminfo的内容来计算的,计算公式是"memfree= free + buffered + cached" - -
-
- -**sysguard_rt** `[rt=seconds] [period=time] [action=/url]` - -**默认:** `-` - -**上下文:** `http, server, location` - -该指令用于配置根据系统的请求平均响应时间来限制用户请求,以保护系统。rt参数用于设置请求的平均响应时间的阈值,单位为秒,平均响应时间的统计周期使用period参数设置。当系统的请求平均响应时间大于阈值时,将当前请求跳转到action参数配置的url,如果action没有配置,则直接返回503。 - -
-
- -**sysguard_mode** `and` | `or` - -**默认:** 'sysguard_mode or' - -**上下文** 'http, server, location' - -如果设置了多个监控指标,此参数用于指定指标间的判断关系,and为全部满足,or为任一满足。 - -
-
- -**sysguard_interval** 'time' - -**默认** 'sysguard_interval 1s' - -**上下文** 'http, server, location' - -该指定用于配置获取系统信息时的缓存时间。默认为1s,则表示在这1s内,只调用一次系统函数来获取系统的当前状况。 - -
-
- -**sysguard_log_level** '[info | notice | warn | error]' - -**默认** 'sysguard_log_level error' - -**上下文** 'http, server, location' - -该指令用于配置,当保护系统的操作执行时,记录日志时的日志级别。 - -## 安装 - - 1. 编译sysguard模块 - - configure [--with-http_sysguard_module | --with-http_sysguard_module=shared] - - --with-http_sysguard_module选项,sysguard模块将被静态编译到tengine中 - - --with-http_sysguard_module=shared, sysguard模块将被编译成动态文件,采用动态模块的方式添加到tengine中 - - 2. 编译,安装 - - make&make install - - 3. 配置sysguard的配置项 - - 4. 运行 diff --git a/Dengine/tengine/docs/modules/ngx_http_upstream_check_module.md b/Dengine/tengine/docs/modules/ngx_http_upstream_check_module.md index 2879b80..458381b 100644 --- a/Dengine/tengine/docs/modules/ngx_http_upstream_check_module.md +++ b/Dengine/tengine/docs/modules/ngx_http_upstream_check_module.md @@ -63,8 +63,6 @@ Context: `upstream` Add health check for the upstream servers. -Passive health checking should not be enabled, as they may interfere. So do not use fail_timeout for the servers in the upstream context for which proactive health checking is enabled. - The parameters' meanings are: * `interval`: the check request's interval time. @@ -109,7 +107,7 @@ In addition, in the case of "GET" method, size of the request uri should not be Syntax: **check\_http\_expect\_alive** `[ http_2xx | http_3xx | http_4xx | http_5xx ]` -Default: `http_2xx http_3xx` +Default: `http_2xx | http_3xx` Context: `upstream` @@ -172,7 +170,7 @@ Below it's the sample html page: 0 backend - 192.168.0.1:80 + 106.187.48.116:80 up 39 0 @@ -185,7 +183,7 @@ Below it's the sample html page: Below it's the sample of csv page: - 0,backend,192.168.0.1:80,up,46,0,http,80 + 0,backend,106.187.48.116:80,up,46,0,http,80 Below it's the sample of json page: @@ -193,7 +191,7 @@ Below it's the sample of json page: "total": 1, "generation": 3, "server": [ - {"index": 0, "upstream": "backend", "name": "192.168.0.1:80", "status": "up", "rise": 58, "fall": 0, "type": "http", "port": 80} + {"index": 0, "upstream": "backend", "name": "106.187.48.116:80", "status": "up", "rise": 58, "fall": 0, "type": "http", "port": 80} ] }} diff --git a/Dengine/tengine/docs/modules/ngx_http_upstream_check_module_cn.md b/Dengine/tengine/docs/modules/ngx_http_upstream_check_module_cn.md index a80fb0a..12ba29e 100644 --- a/Dengine/tengine/docs/modules/ngx_http_upstream_check_module_cn.md +++ b/Dengine/tengine/docs/modules/ngx_http_upstream_check_module_cn.md @@ -74,11 +74,10 @@ Context: `upstream` - `tcp`:简单的tcp连接,如果连接成功,就说明后端正常。 - `ssl_hello`:发送一个初始的SSL hello包并接受服务器的SSL hello包。 - `http`:发送HTTP请求,通过后端的回复包的状态来判断后端是否存活。 - - `fastcgi`:发送fsatcgi请求,通过后端的回复包的状态来判断后端是否存活。 - `mysql`: 向mysql服务器连接,通过接收服务器的greeting包来判断后端是否存活。 - `ajp`:向后端发送AJP协议的Cping包,通过接收Cpong包来判断后端是否存活。 * `port`: 指定后端服务器的检查端口。你可以指定不同于真实服务的后端服务器的端口,比如后端提供的是443端口的应用,你可以去检查80端口的状态来判断后端健康状况。默认是0,表示跟后端server提供真实服务的端口一样。该选项出现于Tengine-1.4.0。 - + ## check\_keepalive\_requests ## @@ -105,18 +104,6 @@ Context: `upstream` 当采用长连接进行健康检查时,需在该指令中添加keep-alive请求头,如:`"HEAD / HTTP/1.1\r\nConnection: keep-alive\r\n\r\n"`。 同时,在采用`"GET"`方法的情况下,请求uri的size不宜过大,确保可以在1个`interval`内传输完成,否则会被健康检查模块视为后端服务器或网络异常。 -## check\_fastcgi\_param ## - -Syntax: **check\_fastcgi\_params** `parameter`:`value` - -Default: `REQUEST_METHOD: GET` - `REQUEST_URI: /` - `SCRIPT_FILENAME: index.php' - -Context: `upstream` - -该指令可以配置fastcgi健康检查包发送的请求的header项。 - ## check\_http\_expect\_alive ## Syntax: **check\_http\_expect\_alive** `[ http_2xx | http_3xx | http_4xx | http_5xx ]` @@ -186,7 +173,7 @@ Context: `location` 0 backend - 192.168.0.1:80 + 106.187.48.116:80 up 39 0 @@ -199,7 +186,7 @@ Context: `location` 下面是csv格式页面的例子: - 0,backend,192.168.0.1:80,up,46,0,http,80 + 0,backend,106.187.48.116:80,up,46,0,http,80 下面是json格式页面的例子: @@ -210,3 +197,4 @@ Context: `location` {"index": 0, "upstream": "backend", "name": "106.187.48.116:80", "status": "up", "rise": 58, "fall": 0, "type": "http", "port": 80} ] }} + diff --git a/Dengine/tengine/docs/modules/ngx_http_upstream_dynamic.md b/Dengine/tengine/docs/modules/ngx_http_upstream_dynamic.md deleted file mode 100644 index bb6a89a..0000000 --- a/Dengine/tengine/docs/modules/ngx_http_upstream_dynamic.md +++ /dev/null @@ -1,47 +0,0 @@ -Name -==== - -* ngx_http_upstream_dynamic_module - -Description -=========== - -* This module provides the functionality to resolve domain names into IP addresses in an upstream at run-time. - -Examples -======== - - upstream backend { - dynamic_resolve fallback=stale fail_timeout=30s; - - server a.com; - server b.com; - } - - server { - ... - - proxy_pass http://backend; - } - -Directives -========== - -dynamic_resolve ---------------- - -**Syntax**: *dynamic_resolve [fallback=stale|next|shutdown] [fail_timeout=time]* - -**Default**: *-* - -**Context**: *upstream* - -Enable dynamic DNS resolving functionality in an upstream. - -The 'fallback' parameter specifies what action to take if a domain name can not be resolved into an IP address: - -* stale, use the original IP addresses resolved when tengine starts. -* next, go to next availiable server in the upstream. -* shutdown, finalize current request. - -The 'fail_timeout' parameter specifies how long time tengine considers the DNS server as unavailiable if a DNS query fails for a server in the upstream. In this period of time, all requests comming will follow what 'fallback' specifies. diff --git a/Dengine/tengine/docs/modules/ngx_http_upstream_dynamic_cn.md b/Dengine/tengine/docs/modules/ngx_http_upstream_dynamic_cn.md deleted file mode 100644 index a2b6a02..0000000 --- a/Dengine/tengine/docs/modules/ngx_http_upstream_dynamic_cn.md +++ /dev/null @@ -1,47 +0,0 @@ -模块名 -===== - -* ngx_http_upstream_dynamic_module - -介绍 -=== - -* 此模块提供了在运行时动态解析upstream中server域名的功能 - -配置示例 -======= - - upstream backend { - dynamic_resolve fallback=stale fail_timeout=30s; - - server a.com; - server b.com; - } - - server { - ... - - proxy_pass http://backend; - } - -指令 -=== - -dynamic_resolve ---------------- - -**语法**: *dynamic_resolve [fallback=stale|next|shutdown] [fail_timeout=time]* - -**默认值**: *-* - -**上下文**: *upstream* - -指定在某个upstream中启用动态域名解析功能。 - -fallback参数指定了当域名无法解析时采取的动作: - -* stale, 使用tengine启动的时候获取的旧地址 -* next, 选择upstream中的下一个server -* shutdown, 结束当前请求 - -fail_timeout参数指定了一个时间,在这个时间范围内,DNS服务将被当作无法使用。具体来说,就是当某次DNS请求失败后,假定后续多长的时间内DNS服务依然不可用,以减少对无效DNS的查询。 diff --git a/Dengine/tengine/modules/ngx_http_lua_module/.gitignore b/Dengine/tengine/modules/ngx_http_lua_module/.gitignore deleted file mode 100644 index 61613b2..0000000 --- a/Dengine/tengine/modules/ngx_http_lua_module/.gitignore +++ /dev/null @@ -1,164 +0,0 @@ -build/ -work/ -tags -cscope.* -*.mobi -genmobi.sh -.libs -*.swp -*.slo -*.la -*.swo -*.lo -*~ -*.o -print.txt -.rsync -*.tar.gz -dist -build[789] -build -tags -update-readme -*.tmp -test/Makefile -test/blib -test.sh -t.sh -t/t.sh -test/t/servroot/ -releng -reset -*.t_ -src/handler.h -src/util.c -src/module.h -src/module.c -src/drizzle.c -src/processor.h -src/handler.c -src/util.h -src/drizzle.h -src/processor.c -src/output.c -src/output.h -libdrizzle -ctags -src/stream.h -nginx -keepalive -reindex -src/keepalive.c -src/keepalive.h -src/checker.h -src/checker.c -src/quoting.h -src/quoting.c -src/module.h -src/module.c -src/util.h -src/util.c -src/processor.h -src/processor.c -src/rds.h -src/utils.h -src/handler.c -src/handler.h -util/bench -*.html -trace.out* -try.sh -src/cache.c -src/cache.h -src/common.h -src/directive.c -src/directive.h -src/consts.[ch] -src/contentby.[ch] -src/pcrefix.[ch] -src/util.c -src/clfactory.c -src/directive.c -src/conf.h -src/setby.h -src/cache.h -src/hook.c -src/util.h -src/hook.h -src/common.h -src/directive.h -src/conf.c -src/setby.c -src/cache.c -src/module.c -src/clfactory.h -src/capturefilter.[ch] -src/contentby.c -pack -b.sh -src/in.[ch] -src/out.[ch] -go -all.sh -src/accessby.[ch] -src/rewriteby.[ch] -src/patch.[ch] -src/ndk.[ch] -src/control.[ch] -src/output.[ch] -src/variable.[ch] -src/string.[ch] -src/misc.[ch] -src/log.[ch] -src/exception.[ch] -src/subrequest.[ch] -src/time.[ch] -src/regex.[ch] -src/ctx.[ch] -src/args.[ch] -src/headers.[ch] -src/script.[ch] -src/filter.[ch] -src/shdict.[ch] -src/body.[ch] -src/uri.[ch] -src/api.[ch] -src/coroutine.[ch] -src/logby.[ch] -src/sleep.[ch] -a.patch -all -build1[0-9] -g -buildroot/ -src/headerfilterby.[ch] -*.patch -analyze -tsock -a.c -test.lua -build12 -ERRORS -src/bodyfilterby.[ch] -src/tcp.[ch] -src/initby.[ch] -src/initworkerby.[ch] -src/socket.[ch] -src/udp.[ch] -src/method.[ch] -tre -src/phase.[ch] -src/probe.h -src/uthread.[ch] -src/timer.[ch] -src/config.[ch] -src/worker.[ch] -*.plist -lua -ttimer -Makefile -tsubreq -tthread -addr2line -hup -theaders diff --git a/Dengine/tengine/modules/ngx_http_lua_module/.gitmodules b/Dengine/tengine/modules/ngx_http_lua_module/.gitmodules deleted file mode 100644 index db339a7..0000000 --- a/Dengine/tengine/modules/ngx_http_lua_module/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "deps/ngx_devel_kit"] - path = deps/ngx_devel_kit - url = git://github.com/simpl/ngx_devel_kit.git diff --git a/Dengine/tengine/modules/ngx_http_lua_module/Changes b/Dengine/tengine/modules/ngx_http_lua_module/Changes deleted file mode 100644 index 703f73d..0000000 --- a/Dengine/tengine/modules/ngx_http_lua_module/Changes +++ /dev/null @@ -1,51 +0,0 @@ -0.2.0 - 5 July 2011 -* now we support ngx.var[1], ngx.var[2], and etc to refer to the nginx regex capturing variables \$1, \$2, and etc in Lua. this resolved github issue #43. thanks Tobia Conforto for reporting it. - -* now we use the same value overriding mechanism as ngx_rewrite's set command for ngx.var.VAR = new_value. Assigning values to special variables like $limit_rate and $args should now work; also writing to built-in variables that are not changeable (like $arg_PARAMETER) will result in a 500 error page, as expected, now. thanks Richard Kearsley for reporting it. - -* fixed the lua_code_cache off warning when the lua_code_cache is explicitly on. thanks Feng Xingguo. - -* applied the patch from cyberty to add ngx.http_time() function to expose the nginx core function ngx_http_time to the Lua land. - -* fixed an issue on i386: we now use off_t consistently. mixing it with size_t on 32-bit systems can cause Bad Things. this fixed github issue #42. thanks moodydeath. - -* fixed an issue on i386: fixed a formatter mismatch issue in ngx_http_echo_adjust_subrequest. thanks Wang Bin. This caused incorrect subrequest Content-Length header when a body is specified. - -* now in the subrequest capturing processor, we worked around an issue in ngx_http_static_module that when it issues 301 redirect for directory access w/o a trailing slash, it does not inject r->headers_out.location into the r->headers_out.headers list. thanks moodydeath for reporting it in the discussion of github issue #41. - -* fixed a bug in ngx.location.capture() and ngx.location.capture_multi() that we could not capture locations with internal redirections in them. thanks moodydeath for reporting it in github issue #41. - -* fixed redundant last chunk issue for ngx.exec() invocation at rewrite and access phases: we should quit the current core_run_phases cycle; this also fixed github issue #40: 2 Subrequest calls when using access_by_lua, ngx.exec and echo_location. - -* fixed ngx.exit(status) where status >= 200 and status < 300 for access_by_lua* and rewrite_by_lua*: it should quit the whole request altegother and skip all those subsequent phase handlers (if any). thanks moodydeath for reporting it. - -* fixed github issue #39: setting differnt response headers in Lua with common prefix might interfere with each other. thanks moodydeath. - -* fixed GitHub issue #38: request headers did not forward to subrequests when the "method" or "body" option is explicitly specified by a non-nil value for ngx.location.capture(). thanks Richard Kearsley. - -* fixed a bug in output header set; we should always set the header->hash to 1. thanks moodydeath for reporting it. - -* fixed spots that trigger the "variable set but not used" warning issued by gcc 4.6.0. - -* now we turn the ngx.req.header table into an ngx.req.get_headers() function; we also added ngx.req.set_header(name, value) and ngx.req.clear_header(name). thanks moodydeath. - -* now we make ngx_devel_kit (NDK) optional. thanks Kirill A. Korinskiy. - -* removed a duplicate definition of the ngx_str_set macro caught by ctags; also fixed a warning thrown by gcc -O3 on Mac OS X 10.6. - -* added patch to use PCRE related Lua extensions in ngx_lua (chaoslawful) - -* now we change the way we process HTTP 1.0 requests by automatically buffering all the user outputs generated by ngx.print()/ngx.say() calls, which is much more natural than the old broken way. - -* fixed the "ngx.exec() after ngx.location.capture() hanging" bug for rewrite_by_lua* and access_by_lua* as well. thanks Wendal Chen. - -* applied a patch from moodydeath to introduce the "ngx.is_subrequest" attribute. - -* now we encourage use of the client_body_in_single_buffer directive instead of big client_body_buffer_size when lua_need_request_body is turned on. - -* fixed the config script and added extra linking options needed by LuaJIT in 64-bit Mac OS X. - -* fixed the zero size alert caused by ngx.print("") in Lua. - -* now we always allocate r->request_body for subrequests when the method option is specified for ngx.location.capture*. this prevents accidental inheritance of parent request's request body when client_body_buffer_size < client_max_body_size. - diff --git a/Dengine/tengine/modules/ngx_http_lua_module/README.markdown b/Dengine/tengine/modules/ngx_http_lua_module/README.markdown deleted file mode 100644 index b344ff5..0000000 --- a/Dengine/tengine/modules/ngx_http_lua_module/README.markdown +++ /dev/null @@ -1,6872 +0,0 @@ - - -Name -==== - -ngx_lua - Embed the power of Lua into Nginx - -*This module is not distributed with the Nginx source.* See [the installation instructions](#installation). - -Table of Contents -================= - -* [Status](#status) -* [Version](#version) -* [Synopsis](#synopsis) -* [Description](#description) -* [Typical Uses](#typical-uses) -* [Nginx Compatibility](#nginx-compatibility) -* [Installation](#installation) - * [C Macro Configurations](#c-macro-configurations) - * [Installation on Ubuntu 11.10](#installation-on-ubuntu-1110) -* [Community](#community) - * [English Mailing List](#english-mailing-list) - * [Chinese Mailing List](#chinese-mailing-list) -* [Code Repository](#code-repository) -* [Bugs and Patches](#bugs-and-patches) -* [Lua/LuaJIT bytecode support](#lualuajit-bytecode-support) -* [System Environment Variable Support](#system-environment-variable-support) -* [HTTP 1.0 support](#http-10-support) -* [Statically Linking Pure Lua Modules](#statically-linking-pure-lua-modules) -* [Data Sharing within an Nginx Worker](#data-sharing-within-an-nginx-worker) -* [Known Issues](#known-issues) - * [TCP socket connect operation issues](#tcp-socket-connect-operation-issues) - * [Lua Coroutine Yielding/Resuming](#lua-coroutine-yieldingresuming) - * [Lua Variable Scope](#lua-variable-scope) - * [Locations Configured by Subrequest Directives of Other Modules](#locations-configured-by-subrequest-directives-of-other-modules) - * [Special PCRE Sequences](#special-pcre-sequences) - * [Mixing with SSI Not Supported](#mixing-with-ssi-not-supported) - * [SPDY Mode Not Fully Supported](#spdy-mode-not-fully-supported) -* [TODO](#todo) - * [Short Term](#short-term) - * [Longer Term](#longer-term) -* [Changes](#changes) -* [Test Suite](#test-suite) -* [Copyright and License](#copyright-and-license) -* [See Also](#see-also) -* [Directives](#directives) -* [Nginx API for Lua](#nginx-api-for-lua) - -Status -====== - -This module is under active development and is production ready. - -Version -======= - -This document describes ngx_lua [v0.9.12](https://github.com/openresty/lua-nginx-module/tags) released on 2 September 2014. - -Synopsis -======== -```nginx - -# set search paths for pure Lua external libraries (';;' is the default path): -lua_package_path '/foo/bar/?.lua;/blah/?.lua;;'; - -# set search paths for Lua external libraries written in C (can also use ';;'): -lua_package_cpath '/bar/baz/?.so;/blah/blah/?.so;;'; - -server { - location /inline_concat { - # MIME type determined by default_type: - default_type 'text/plain'; - - set $a "hello"; - set $b "world"; - # inline Lua script - set_by_lua $res "return ngx.arg[1]..ngx.arg[2]" $a $b; - echo $res; - } - - location /rel_file_concat { - set $a "foo"; - set $b "bar"; - # script path relative to nginx prefix - # $ngx_prefix/conf/concat.lua contents: - # - # return ngx.arg[1]..ngx.arg[2] - # - set_by_lua_file $res conf/concat.lua $a $b; - echo $res; - } - - location /abs_file_concat { - set $a "fee"; - set $b "baz"; - # absolute script path not modified - set_by_lua_file $res /usr/nginx/conf/concat.lua $a $b; - echo $res; - } - - location /lua_content { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua "ngx.say('Hello,world!')"; - } - - location /nginx_var { - # MIME type determined by default_type: - default_type 'text/plain'; - - # try access /nginx_var?a=hello,world - content_by_lua "ngx.print(ngx.var['arg_a'], '\\n')"; - } - - location /request_body { - # force reading request body (default off) - lua_need_request_body on; - client_max_body_size 50k; - client_body_buffer_size 50k; - - content_by_lua 'ngx.print(ngx.var.request_body)'; - } - - # transparent non-blocking I/O in Lua via subrequests - location /lua { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua ' - local res = ngx.location.capture("/some_other_location") - if res.status == 200 then - ngx.print(res.body) - end'; - } - - # GET /recur?num=5 - location /recur { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua ' - local num = tonumber(ngx.var.arg_num) or 0 - - if num > 50 then - ngx.say("num too big") - return - end - - ngx.say("num is: ", num) - - if num > 0 then - res = ngx.location.capture("/recur?num=" .. tostring(num - 1)) - ngx.print("status=", res.status, " ") - ngx.print("body=", res.body) - else - ngx.say("end") - end - '; - } - - location /foo { - rewrite_by_lua ' - res = ngx.location.capture("/memc", - { args = { cmd = "incr", key = ngx.var.uri } } - ) - '; - - proxy_pass http://blah.blah.com; - } - - location /blah { - access_by_lua ' - local res = ngx.location.capture("/auth") - - if res.status == ngx.HTTP_OK then - return - end - - if res.status == ngx.HTTP_FORBIDDEN then - ngx.exit(res.status) - end - - ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) - '; - - # proxy_pass/fastcgi_pass/postgres_pass/... - } - - location /mixed { - rewrite_by_lua_file /path/to/rewrite.lua; - access_by_lua_file /path/to/access.lua; - content_by_lua_file /path/to/content.lua; - } - - # use nginx var in code path - # WARN: contents in nginx var must be carefully filtered, - # otherwise there'll be great security risk! - location ~ ^/app/(.+) { - content_by_lua_file /path/to/lua/app/root/$1.lua; - } - - location / { - lua_need_request_body on; - - client_max_body_size 100k; - client_body_buffer_size 100k; - - access_by_lua ' - -- check the client IP address is in our black list - if ngx.var.remote_addr == "132.5.72.3" then - ngx.exit(ngx.HTTP_FORBIDDEN) - end - - -- check if the request body contains bad words - if ngx.var.request_body and - string.match(ngx.var.request_body, "fsck") - then - return ngx.redirect("/terms_of_use.html") - end - - -- tests passed - '; - - # proxy_pass/fastcgi_pass/etc settings - } -} -``` - -[Back to TOC](#table-of-contents) - -Description -=========== - -This module embeds Lua, via the standard Lua 5.1 interpreter or [LuaJIT 2.0/2.1](http://luajit.org/luajit.html), into Nginx and by leveraging Nginx's subrequests, allows the integration of the powerful Lua threads (Lua coroutines) into the Nginx event model. - -Unlike [Apache's mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html) and [Lighttpd's mod_magnet](http://redmine.lighttpd.net/wiki/1/Docs:ModMagnet), Lua code executed using this module can be *100% non-blocking* on network traffic as long as the [Nginx API for Lua](#nginx-api-for-lua) provided by this module is used to handle -requests to upstream services such as MySQL, PostgreSQL, Memcached, Redis, or upstream HTTP web services. - -At least the following Lua libraries and Nginx modules can be used with this ngx_lua module: - -* [lua-resty-memcached](https://github.com/openresty/lua-resty-memcached) -* [lua-resty-mysql](https://github.com/openresty/lua-resty-mysql) -* [lua-resty-redis](https://github.com/openresty/lua-resty-redis) -* [lua-resty-dns](https://github.com/openresty/lua-resty-dns) -* [lua-resty-upload](https://github.com/openresty/lua-resty-upload) -* [lua-resty-websocket](https://github.com/openresty/lua-resty-websocket) -* [lua-resty-lock](https://github.com/openresty/lua-resty-lock) -* [lua-resty-string](https://github.com/openresty/lua-resty-string) -* [ngx_memc](http://github.com/openresty/memc-nginx-module) -* [ngx_postgres](https://github.com/FRiCKLE/ngx_postgres) -* [ngx_redis2](http://github.com/openresty/redis2-nginx-module) -* [ngx_redis](http://wiki.nginx.org/HttpRedisModule) -* [ngx_proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html) -* [ngx_fastcgi](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html) - -Almost all the Nginx modules can be used with this ngx_lua module by means of [ngx.location.capture](#ngxlocationcapture) or [ngx.location.capture_multi](#ngxlocationcapture_multi) but it is recommended to use those `lua-resty-*` libraries instead of creating subrequests to access the Nginx upstream modules because the former is usually much more flexible and memory-efficient. - -The Lua interpreter or LuaJIT instance is shared across all the requests in a single nginx worker process but request contexts are segregated using lightweight Lua coroutines. - -Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint in Lua even when under heavy loads. - -[Back to TOC](#table-of-contents) - -Typical Uses -============ - -Just to name a few: - -* Mashup'ing and processing outputs of various nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua, -* doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends, -* manipulating response headers in an arbitrary way (by Lua) -* fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly, -* coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other storage, -* doing very complex URL dispatch in Lua at rewrite phase, -* using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations. - -The possibilities are unlimited as the module allows bringing together various elements within Nginx as well as exposing the power of the Lua language to the user. The module provides the full flexibility of scripting while offering performance levels comparable with native C language programs both in terms of CPU time as well as memory footprint. This is particularly the case when LuaJIT 2.x is enabled. - -Other scripting language implementations typically struggle to match this performance level. - -The Lua state (Lua VM instance) is shared across all the requests handled by a single nginx worker process to minimize memory use. - -[Back to TOC](#table-of-contents) - -Nginx Compatibility -=================== -The latest module is compatible with the following versions of Nginx: - -* 1.7.x (last tested: 1.7.4) -* 1.6.x -* 1.5.x (last tested: 1.5.12) -* 1.4.x (last tested: 1.4.4) -* 1.3.x (last tested: 1.3.11) -* 1.2.x (last tested: 1.2.9) -* 1.1.x (last tested: 1.1.5) -* 1.0.x (last tested: 1.0.15) -* 0.9.x (last tested: 0.9.4) -* 0.8.x >= 0.8.54 (last tested: 0.8.54) - -[Back to TOC](#table-of-contents) - -Installation -============ - -The [ngx_openresty bundle](http://openresty.org) can be used to install Nginx, ngx_lua, either one of the standard Lua 5.1 interpreter or LuaJIT 2.0/2.1, as well as a package of powerful companion Nginx modules. The basic installation step is a simple `./configure --with-luajit && make && make install`. - -Alternatively, ngx_lua can be manually compiled into Nginx: - -1. Install LuaJIT 2.0 or 2.1 (recommended) or Lua 5.1 (Lua 5.2 is *not* supported yet). LuaJIT can be downloaded from the [the LuaJIT project website](http://luajit.org/download.html) and Lua 5.1, from the [Lua project website](http://www.lua.org/). Some distribution package managers also distribute LuajIT and/or Lua. -1. Download the latest version of the ngx_devel_kit (NDK) module [HERE](http://github.com/simpl/ngx_devel_kit/tags). -1. Download the latest version of ngx_lua [HERE](http://github.com/openresty/lua-nginx-module/tags). -1. Download the latest version of Nginx [HERE](http://nginx.org/) (See [Nginx Compatibility](#nginx-compatibility)) - -Build the source with this module: - -```bash - -wget 'http://nginx.org/download/nginx-1.7.4.tar.gz' -tar -xzvf nginx-1.7.4.tar.gz -cd nginx-1.7.4/ - -# tell nginx's build system where to find LuaJIT 2.0: -export LUAJIT_LIB=/path/to/luajit/lib -export LUAJIT_INC=/path/to/luajit/include/luajit-2.0 - -# tell nginx's build system where to find LuaJIT 2.1: -export LUAJIT_LIB=/path/to/luajit/lib -export LUAJIT_INC=/path/to/luajit/include/luajit-2.1 - -# or tell where to find Lua if using Lua instead: -#export LUA_LIB=/path/to/lua/lib -#export LUA_INC=/path/to/lua/include - -# Here we assume Nginx is to be installed under /opt/nginx/. -./configure --prefix=/opt/nginx \ - --add-module=/path/to/ngx_devel_kit \ - --add-module=/path/to/lua-nginx-module - -make -j2 -make install -``` - -[Back to TOC](#table-of-contents) - -C Macro Configurations ----------------------- - -While building this module either via OpenResty or with the NGINX core, you can define the following C macros via the C compiler options: - -* `NGX_LUA_USE_ASSERT` - When defined, will enable assertions in the ngx_lua C code base. Recommended for debugging or testing builds. It can introduce some (small) runtime overhead when enabled. This macro was first introduced in the `v0.9.10` release. -* `NGX_LUA_ABORT_AT_PANIC` - When the Lua/LuaJIT VM panics, ngx_lua will instruct the current nginx worker process to quit gracefully by default. By specifying this C macro, ngx_lua will abort the current nginx worker process (which usually result in a core dump file) immediately. This option is useful for debugging VM panics. This option was first introduced in the `v0.9.8` release. -* `NGX_LUA_NO_FFI_API` - Excludes pure C API functions for FFI-based Lua API for NGINX (as required by [lua-resty-core](https://github.com/openresty/lua-resty-core#readme), for example). Enabling this macro can make the resulting binary code size smaller. - -To enable one or more of these macros, just pass extra C compiler options to the `./configure` script of either NGINX or OpenResty. For instance, - - - ./configure --with-cc-opt="-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC" - - -[Back to TOC](#table-of-contents) - -Installation on Ubuntu 11.10 ----------------------------- - -Note that it is recommended to use LuaJIT 2.0 or LuaJIT 2.1 instead of the standard Lua 5.1 interpreter wherever possible. - -If the standard Lua 5.1 interpreter is required however, run the following command to install it from the Ubuntu repository: - -```bash - -apt-get install -y lua5.1 liblua5.1-0 liblua5.1-0-dev -``` - -Everything should be installed correctly, except for one small tweak. - -Library name `liblua.so` has been changed in liblua5.1 package, it only comes with `liblua5.1.so`, which needs to be symlinked to `/usr/lib` so it could be found during the configuration process. - -```bash - -ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/lib/liblua.so -``` - -[Back to TOC](#table-of-contents) - -Community -========= - -[Back to TOC](#table-of-contents) - -English Mailing List --------------------- - -The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers. - -[Back to TOC](#table-of-contents) - -Chinese Mailing List --------------------- - -The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers. - -[Back to TOC](#table-of-contents) - -Code Repository -=============== - -The code repository of this project is hosted on github at [openresty/lua-nginx-module](http://github.com/openresty/lua-nginx-module). - -[Back to TOC](#table-of-contents) - -Bugs and Patches -================ - -Please submit bug reports, wishlists, or patches by - -1. creating a ticket on the [GitHub Issue Tracker](https://github.com/openresty/lua-nginx-module/issues), -1. or posting to the [OpenResty community](#community). - -[Back to TOC](#table-of-contents) - -Lua/LuaJIT bytecode support -=========================== - -As from the `v0.5.0rc32` release, all `*_by_lua_file` configure directives (such as [content_by_lua_file](#content_by_lua_file)) support loading Lua 5.1 and LuaJIT 2.0/2.1 raw bytecode files directly. - -Please note that the bytecode format used by LuaJIT 2.0/2.1 is not compatible with that used by the standard Lua 5.1 interpreter. So if using LuaJIT 2.0/2.1 with ngx_lua, LuaJIT compatible bytecode files must be generated as shown: - -```bash - -/path/to/luajit/bin/luajit -b /path/to/input_file.lua /path/to/output_file.luac -``` - -The `-bg` option can be used to include debug information in the LuaJIT bytecode file: - -```bash - -/path/to/luajit/bin/luajit -bg /path/to/input_file.lua /path/to/output_file.luac -``` - -Please refer to the official LuaJIT documentation on the `-b` option for more details: - - - -Also, the bytecode files generated by LuaJIT 2.1 is *not* compatible with LuaJIT 2.0, and vice versa. The support for LuaJIT 2.1 bytecode was first added in ngx_lua v0.9.3. - -Similarly, if using the standard Lua 5.1 interpreter with ngx_lua, Lua compatible bytecode files must be generated using the `luac` commandline utility as shown: - -```bash - -luac -o /path/to/output_file.luac /path/to/input_file.lua -``` - -Unlike as with LuaJIT, debug information is included in standard Lua 5.1 bytecode files by default. This can be striped out by specifying the `-s` option as shown: - -```bash - -luac -s -o /path/to/output_file.luac /path/to/input_file.lua -``` - -Attempts to load standard Lua 5.1 bytecode files into ngx_lua instances linked to LuaJIT 2.0/2.1 or vice versa, will result in an error message, such as that below, being logged into the Nginx `error.log` file: - - - [error] 13909#0: *1 failed to load Lua inlined code: bad byte-code header in /path/to/test_file.luac - - -Loading bytecode files via the Lua primitives like `require` and `dofile` should always work as expected. - -[Back to TOC](#table-of-contents) - -System Environment Variable Support -=================================== - -If you want to access the system environment variable, say, `foo`, in Lua via the standard Lua API [os.getenv](http://www.lua.org/manual/5.1/manual.html#pdf-os.getenv), then you should also list this environment variable name in your `nginx.conf` file via the [env directive](http://nginx.org/en/docs/ngx_core_module.html#env). For example, - -```nginx - -env foo; -``` - -[Back to TOC](#table-of-contents) - -HTTP 1.0 support -================ - -The HTTP 1.0 protocol does not support chunked output and requires an explicit `Content-Length` header when the response body is not empty in order to support the HTTP 1.0 keep-alive. -So when a HTTP 1.0 request is made and the [lua_http10_buffering](#lua_http10_buffering) directive is turned `on`, ngx_lua will buffer the -output of [ngx.say](#ngxsay) and [ngx.print](#ngxprint) calls and also postpone sending response headers until all the response body output is received. -At that time ngx_lua can calculate the total length of the body and construct a proper `Content-Length` header to return to the HTTP 1.0 client. -If the `Content-Length` response header is set in the running Lua code, however, this buffering will be disabled even if the [lua_http10_buffering](#lua_http10_buffering) directive is turned `on`. - -For large streaming output responses, it is important to disable the [lua_http10_buffering](#lua_http10_buffering) directive to minimise memory usage. - -Note that common HTTP benchmark tools such as `ab` and `http_load` issue HTTP 1.0 requests by default. -To force `curl` to send HTTP 1.0 requests, use the `-0` option. - -[Back to TOC](#table-of-contents) - -Statically Linking Pure Lua Modules -=================================== - -When LuaJIT 2.x is used, it is possible to statically link the bytecode of pure Lua modules into the Nginx executable. - -Basically you use the `luajit` executable to compile `.lua` Lua module files to `.o` object files containing the exported bytecode data, and then link the `.o` files directly in your Nginx build. - -Below is a trivial example to demonstrate this. Consider that we have the following `.lua` file named `foo.lua`: - -```lua - --- foo.lua -local _M = {} - -function _M.go() - print("Hello from foo") -end - -return _M -``` - -And then we compile this `.lua` file to `foo.o` file: - - /path/to/luajit/bin/luajit -bg foo.lua foo.o - -What matters here is the name of the `.lua` file, which determines how you use this module later on the Lua land. The file name `foo.o` does not matter at all except the `.o` file extension (which tells `luajit` what output format is used). If you want to strip the Lua debug information from the resulting bytecode, you can just specify the `-b` option above instead of `-bg`. - -Then when building Nginx or OpenResty, pass the `--with-ld-opt="foo.o"` option to the `./configure` script: - -```bash - -./configure --with-ld-opt="/path/to/foo.o" ... -``` - -Finally, you can just do the following in any Lua code run by ngx_lua: - -```lua - -local foo = require "foo" -foo.go() -``` - -And this piece of code no longer depends on the external `foo.lua` file any more because it has already been compiled into the `nginx` executable. - -If you want to use dot in the Lua module name when calling `require`, as in - -```lua - -local foo = require "resty.foo" -``` - -then you need to rename the `foo.lua` file to `resty_foo.lua` before compiling it down to a `.o` file with the `luajit` command-line utility. - -It is important to use exactly the same version of LuaJIT when compiling `.lua` files to `.o` files as building nginx + ngx_lua. This is because the LuaJIT bytecode format may be incompatible between different LuaJIT versions. When the bytecode format is incompatible, you will see a Lua runtime error saying that the Lua module is not found. - -When you have multiple `.lua` files to compile and link, then just specify their `.o` files at the same time in the value of the `--with-ld-opt` option. For instance, - -```bash - -./configure --with-ld-opt="/path/to/foo.o /path/to/bar.o" ... -``` - -If you have just too many `.o` files, then it might not be feasible to name them all in a single command. In this case, you can build a static library (or archive) for your `.o` files, as in - -```bash - -ar rcus libmyluafiles.a *.o -``` - -then you can link the `myluafiles` archive as a whole to your nginx executable: - -```bash - -./configure \ - --with-ld-opt="-L/path/to/lib -Wl,--whole-archive -lmyluafiles -Wl,--no-whole-archive" -``` - -where `/path/to/lib` is the path of the directory containing the `libmyluafiles.a` file. It should be noted that the linker option `--whole-archive` is required here because otherwise our archive will be skipped because no symbols in our archive are mentioned in the main parts of the nginx executable. - -[Back to TOC](#table-of-contents) - -Data Sharing within an Nginx Worker -=================================== - -To globally share data among all the requests handled by the same nginx worker process, encapsulate the shared data into a Lua module, use the Lua `require` builtin to import the module, and then manipulate the shared data in Lua. This works because required Lua modules are loaded only once and all coroutines will share the same copy of the module (both its code and data). Note however that Lua global variables (note, not module-level variables) WILL NOT persist between requests because of the one-coroutine-per-request isolation design. - -Here is a complete small example: - -```lua - --- mydata.lua -local _M = {} - -local data = { - dog = 3, - cat = 4, - pig = 5, -} - -function _M.get_age(name) - return data[name] -end - -return _M -``` - -and then accessing it from `nginx.conf`: - -```nginx - -location /lua { - content_by_lua ' - local mydata = require "mydata" - ngx.say(mydata.get_age("dog")) - '; -} -``` - -The `mydata` module in this example will only be loaded and run on the first request to the location `/lua`, -and all subsequent requests to the same nginx worker process will use the reloaded instance of the -module as well as the same copy of the data in it, until a `HUP` signal is sent to the Nginx master process to force a reload. -This data sharing technique is essential for high performance Lua applications based on this module. - -Note that this data sharing is on a *per-worker* basis and not on a *per-server* basis. That is, when there are multiple nginx worker processes under an Nginx master, data sharing cannot cross the process boundary between these workers. - -It is usually recommended to share read-only data this way. You can also share changeable data among all the concurrent requests of each nginx worker process as -long as there is *no* nonblocking I/O operations (including [ngx.sleep](#ngxsleep)) -in the middle of your calculations. As long as you do not give the -control back to the nginx event loop and ngx_lua's light thread -scheduler (even implicitly), there can never be any race conditions in -between. For this reason, always be very careful when you want to share changeable data on the -worker level. Buggy optimizations can easily lead to hard-to-debug -race conditions under load. - -If server-wide data sharing is required, then use one or more of the following approaches: - -1. Use the [ngx.shared.DICT](#ngxshareddict) API provided by this module. -1. Use only a single nginx worker and a single server (this is however not recommended when there is a multi core CPU or multiple CPUs in a single machine). -1. Use data storage mechanisms such as `memcached`, `redis`, `MySQL` or `PostgreSQL`. [The ngx_openresty bundle](http://openresty.org) associated with this module comes with a set of companion Nginx modules and Lua libraries that provide interfaces with these data storage mechanisms. - -[Back to TOC](#table-of-contents) - -Known Issues -============ - -[Back to TOC](#table-of-contents) - -TCP socket connect operation issues ------------------------------------ -The [tcpsock:connect](#tcpsockconnect) method may indicate `success` despite connection failures such as with `Connection Refused` errors. - -However, later attempts to manipulate the cosocket object will fail and return the actual error status message generated by the failed connect operation. - -This issue is due to limitations in the Nginx event model and only appears to affect Mac OS X. - -[Back to TOC](#table-of-contents) - -Lua Coroutine Yielding/Resuming -------------------------------- -* Because Lua's `dofile` and `require` builtins are currently implemented as C functions in both Lua 5.1 and LuaJIT 2.0/2.1, if the Lua file being loaded by `dofile` or `require` invokes [ngx.location.capture*](#ngxlocationcapture), [ngx.exec](#ngxexec), [ngx.exit](#ngxexit), or other API functions requiring yielding in the *top-level* scope of the Lua file, then the Lua error "attempt to yield across C-call boundary" will be raised. To avoid this, put these calls requiring yielding into your own Lua functions in the Lua file instead of the top-level scope of the file. -* As the standard Lua 5.1 interpreter's VM is not fully resumable, the methods [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), [ngx.redirect](#ngxredirect), [ngx.exec](#ngxexec), and [ngx.exit](#ngxexit) cannot be used within the context of a Lua [pcall()](http://www.lua.org/manual/5.1/manual.html#pdf-pcall) or [xpcall()](http://www.lua.org/manual/5.1/manual.html#pdf-xpcall) or even the first line of the `for ... in ...` statement when the standard Lua 5.1 interpreter is used and the `attempt to yield across metamethod/C-call boundary` error will be produced. Please use LuaJIT 2.x, which supports a fully resumable VM, to avoid this. - -[Back to TOC](#table-of-contents) - -Lua Variable Scope ------------------- -Care must be taken when importing modules and this form should be used: - -```lua - -local xxx = require('xxx') -``` - -instead of the old deprecated form: - -```lua - -require('xxx') -``` - -Here is the reason: by design, the global environment has exactly the same lifetime as the Nginx request handler associated with it. Each request handler has its own set of Lua global variables and that is the idea of request isolation. The Lua module is actually loaded by the first Nginx request handler and is cached by the `require()` built-in in the `package.loaded` table for later reference, and the `module()` builtin used by some Lua modules has the side effect of setting a global variable to the loaded module table. But this global variable will be cleared at the end of the request handler, and every subsequent request handler all has its own (clean) global environment. So one will get Lua exception for accessing the `nil` value. - -Generally, use of Lua global variables is a really really bad idea in the context of ngx_lua because - -1. misuse of Lua globals has very bad side effects for concurrent requests when these variables are actually supposed to be local only, -1. Lua global variables require Lua table look-up in the global environment (which is just a Lua table), which is kinda expensive, and -1. some Lua global variable references are just typos, which are hard to debug. - -It's *highly* recommended to always declare them via "local" in the scope that is reasonable. - -To find out all the uses of Lua global variables in your Lua code, you can run the [lua-releng tool](https://github.com/openresty/nginx-devel-utils/blob/master/lua-releng) across all your .lua source files: - - $ lua-releng - Checking use of Lua global variables in file lib/foo/bar.lua ... - 1 [1489] SETGLOBAL 7 -1 ; contains - 55 [1506] GETGLOBAL 7 -3 ; setvar - 3 [1545] GETGLOBAL 3 -4 ; varexpand - -The output says that the line 1489 of file `lib/foo/bar.lua` writes to a global variable named `contains`, the line 1506 reads from the global variable `setvar`, and line 1545 reads the global `varexpand`. - -This tool will guarantee that local variables in the Lua module functions are all declared with the `local` keyword, otherwise a runtime exception will be thrown. It prevents undesirable race conditions while accessing such variables. See [Data Sharing within an Nginx Worker](#data_sharing_within_an_nginx_worker) for the reasons behind this. - -[Back to TOC](#table-of-contents) - -Locations Configured by Subrequest Directives of Other Modules --------------------------------------------------------------- -The [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) directives cannot capture locations that include the [echo_location](http://github.com/openresty/echo-nginx-module#echo_location), [echo_location_async](http://github.com/openresty/echo-nginx-module#echo_location_async), [echo_subrequest](http://github.com/openresty/echo-nginx-module#echo_subrequest), or [echo_subrequest_async](http://github.com/openresty/echo-nginx-module#echo_subrequest_async) directives. - -```nginx - -location /foo { - content_by_lua ' - res = ngx.location.capture("/bar") - '; -} -location /bar { - echo_location /blah; -} -location /blah { - echo "Success!"; -} -``` - -```nginx - -$ curl -i http://example.com/foo -``` - -will not work as expected. - -[Back to TOC](#table-of-contents) - -Special PCRE Sequences ----------------------- -PCRE sequences such as `\d`, `\s`, or `\w`, require special attention because in string literals, the backslash character, `\`, is stripped out by both the Lua language parser and by the Nginx config file parser before processing. So the following snippet will not work as expected: - -```nginx - -# nginx.conf -? location /test { -? content_by_lua ' -? local regex = "\d+" -- THIS IS WRONG!! -? local m = ngx.re.match("hello, 1234", regex) -? if m then ngx.say(m[0]) else ngx.say("not matched!") end -? '; -? } -# evaluates to "not matched!" -``` - -To avoid this, *double* escape the backslash: - -```nginx - -# nginx.conf -location /test { - content_by_lua ' - local regex = "\\\\d+" - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - '; -} -# evaluates to "1234" -``` - -Here, `\\\\d+` is stripped down to `\\d+` by the Nginx config file parser and this is further stripped down to `\d+` by the Lua language parser before running. - -Alternatively, the regex pattern can be presented as a long-bracketed Lua string literal by encasing it in "long brackets", `[[...]]`, in which case backslashes have to only be escaped once for the Nginx config file parser. - -```nginx - -# nginx.conf -location /test { - content_by_lua ' - local regex = [[\\d+]] - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - '; -} -# evaluates to "1234" -``` - -Here, `[[\\d+]]` is stripped down to `[[\d+]]` by the Nginx config file parser and this is processed correctly. - -Note that a longer from of the long bracket, `[=[...]=]`, may be required if the regex pattern contains `[...]` sequences. -The `[=[...]=]` form may be used as the default form if desired. - -```nginx - -# nginx.conf -location /test { - content_by_lua ' - local regex = [=[[0-9]+]=] - local m = ngx.re.match("hello, 1234", regex) - if m then ngx.say(m[0]) else ngx.say("not matched!") end - '; -} -# evaluates to "1234" -``` - -An alternative approach to escaping PCRE sequences is to ensure that Lua code is placed in external script files and executed using the various `*_by_lua_file` directives. -With this approach, the backslashes are only stripped by the Lua language parser and therefore only need to be escaped once each. - -```lua - --- test.lua -local regex = "\\d+" -local m = ngx.re.match("hello, 1234", regex) -if m then ngx.say(m[0]) else ngx.say("not matched!") end --- evaluates to "1234" -``` - -Within external script files, PCRE sequences presented as long-bracketed Lua string literals do not require modification. - -```lua - --- test.lua -local regex = [[\d+]] -local m = ngx.re.match("hello, 1234", regex) -if m then ngx.say(m[0]) else ngx.say("not matched!") end --- evaluates to "1234" -``` - -[Back to TOC](#table-of-contents) - -Mixing with SSI Not Supported ------------------------------ - -Mixing SSI with ngx_lua in the same Nginx request is not supported at all. Just use ngx_lua exclusively. Everything you can do with SSI can be done atop ngx_lua anyway and it can be more efficient when using ngx_lua. - -[Back to TOC](#table-of-contents) - -SPDY Mode Not Fully Supported ------------------------------ - -Certain Lua APIs provided by ngx_lua do not work in Nginx's SPDY mode yet: [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), and [ngx.req.socket](#ngxreqsocket). - -[Back to TOC](#table-of-contents) - -TODO -==== - -[Back to TOC](#table-of-contents) - -Short Term ----------- -* review and apply Jader H. Silva's patch for `ngx.re.split()`. -* review and apply vadim-pavlov's patch for [ngx.location.capture](#ngxlocationcapture)'s `extra_headers` option -* use `ngx_hash_t` to optimize the built-in header look-up process for [ngx.req.set_header](#ngxreqset_header), [ngx.header.HEADER](#ngxheaderheader), and etc. -* add configure options for different strategies of handling the cosocket connection exceeding in the pools. -* add directives to run Lua codes when nginx stops. -* add `ignore_resp_headers`, `ignore_resp_body`, and `ignore_resp` options to [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) methods, to allow micro performance tuning on the user side. - -[Back to TOC](#table-of-contents) - -Longer Term ------------ -* add automatic Lua code time slicing support by yielding and resuming the Lua VM actively via Lua's debug hooks. -* add `stat` mode similar to [mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html). - -[Back to TOC](#table-of-contents) - -Changes -======= - -The changes of every release of this module can be obtained from the ngx_openresty bundle's change logs: - - - -[Back to TOC](#table-of-contents) - -Test Suite -========== - -The following dependencies are required to run the test suite: - -* Nginx version >= 1.4.2 - -* Perl modules: - * Test::Nginx: - -* Nginx modules: - * [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) - * [ngx_set_misc](http://github.com/openresty/set-misc-nginx-module) - * [ngx_auth_request](http://mdounin.ru/files/ngx_http_auth_request_module-0.2.tar.gz) (this is not needed if you're using Nginx 1.5.4+. - * [ngx_echo](http://github.com/openresty/echo-nginx-module) - * [ngx_memc](http://github.com/openresty/memc-nginx-module) - * [ngx_srcache](http://github.com/openresty/srcache-nginx-module) - * ngx_lua (i.e., this module) - * [ngx_lua_upstream](http://github.com/openresty/lua-upstream-nginx-module) - * [ngx_headers_more](http://github.com/openresty/headers-more-nginx-module) - * [ngx_drizzle](http://github.com/openresty/drizzle-nginx-module) - * [ngx_rds_json](http://github.com/openresty/rds-json-nginx-module) - * [ngx_coolkit](https://github.com/FRiCKLE/ngx_coolkit) - * [ngx_redis2](http://github.com/openresty/redis2-nginx-module) - -The order in which these modules are added during configuration is important because the position of any filter module in the -filtering chain determines the final output, for example. The correct adding order is shown above. - -* 3rd-party Lua libraries: - * [lua-cjson](http://www.kyne.com.au/~mark/software/lua-cjson.php) - -* Applications: - * mysql: create database 'ngx_test', grant all privileges to user 'ngx_test', password is 'ngx_test' - * memcached: listening on the default port, 11211. - * redis: listening on the default port, 6379. - -See also the [developer build script](https://github.com/openresty/lua-nginx-module/blob/master/util/build2.sh) for more details on setting up the testing environment. - -To run the whole test suite in the default testing mode: - - cd /path/to/lua-nginx-module - export PATH=/path/to/your/nginx/sbin:$PATH - prove -I/path/to/test-nginx/lib -r t - - -To run specific test files: - - cd /path/to/lua-nginx-module - export PATH=/path/to/your/nginx/sbin:$PATH - prove -I/path/to/test-nginx/lib t/002-content.t t/003-errors.t - - -To run a specific test block in a particular test file, add the line `--- ONLY` to the test block you want to run, and then use the `prove` utility to run that `.t` file. - -There are also various testing modes based on mockeagain, valgrind, and etc. Refer to the [Test::Nginx documentation](http://search.cpan.org/perldoc?Test::Nginx) for more details for various advanced testing modes. See also the test reports for the Nginx test cluster running on Amazon EC2: - -[Back to TOC](#table-of-contents) - -Copyright and License -===================== - -This module is licensed under the BSD license. - -Copyright (C) 2009-2014, by Xiaozhe Wang (chaoslawful) . - -Copyright (C) 2009-2014, by Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -[Back to TOC](#table-of-contents) - -See Also -======== - -* [lua-resty-memcached](http://github.com/openresty/lua-resty-memcached) library based on ngx_lua cosocket. -* [lua-resty-redis](http://github.com/openresty/lua-resty-redis) library based on ngx_lua cosocket. -* [lua-resty-mysql](http://github.com/openresty/lua-resty-mysql) library based on ngx_lua cosocket. -* [lua-resty-upload](http://github.com/openresty/lua-resty-upload) library based on ngx_lua cosocket. -* [lua-resty-dns](http://github.com/openresty/lua-resty-dns) library based on ngx_lua cosocket. -* [lua-resty-websocket](http://github.com/openresty/lua-resty-websocket) library for both WebSocket server and client, based on ngx_lua cosocket. -* [lua-resty-string](http://github.com/openresty/lua-resty-string) library based on [LuaJIT FFI](http://luajit.org/ext_ffi.html). -* [lua-resty-lock](http://github.com/openresty/lua-resty-lock) library for a nonblocking simple lock API. -* [Routing requests to different MySQL queries based on URI arguments](http://openresty.org/#RoutingMySQLQueriesBasedOnURIArgs) -* [Dynamic Routing Based on Redis and Lua](http://openresty.org/#DynamicRoutingBasedOnRedis) -* [Using LuaRocks with ngx_lua](http://openresty.org/#UsingLuaRocks) -* [Introduction to ngx_lua](https://github.com/openresty/lua-nginx-module/wiki/Introduction) -* [ngx_devel_kit](http://github.com/simpl/ngx_devel_kit) -* [echo-nginx-module](http://github.com/openresty/echo-nginx-module) -* [drizzle-nginx-module](http://github.com/openresty/drizzle-nginx-module) -* [postgres-nginx-module](http://github.com/FRiCKLE/ngx_postgres) -* [memc-nginx-module](http://github.com/openresty/memc-nginx-module) -* [The ngx_openresty bundle](http://openresty.org) -* [Nginx Systemtap Toolkit](https://github.com/openresty/nginx-systemtap-toolkit) - -[Back to TOC](#table-of-contents) - -Directives -========== - -* [lua_use_default_type](#lua_use_default_type) -* [lua_code_cache](#lua_code_cache) -* [lua_regex_cache_max_entries](#lua_regex_cache_max_entries) -* [lua_regex_match_limit](#lua_regex_match_limit) -* [lua_package_path](#lua_package_path) -* [lua_package_cpath](#lua_package_cpath) -* [init_by_lua](#init_by_lua) -* [init_by_lua_file](#init_by_lua_file) -* [init_worker_by_lua](#init_worker_by_lua) -* [init_worker_by_lua_file](#init_worker_by_lua_file) -* [set_by_lua](#set_by_lua) -* [set_by_lua_file](#set_by_lua_file) -* [content_by_lua](#content_by_lua) -* [content_by_lua_file](#content_by_lua_file) -* [rewrite_by_lua](#rewrite_by_lua) -* [rewrite_by_lua_file](#rewrite_by_lua_file) -* [access_by_lua](#access_by_lua) -* [access_by_lua_file](#access_by_lua_file) -* [header_filter_by_lua](#header_filter_by_lua) -* [header_filter_by_lua_file](#header_filter_by_lua_file) -* [body_filter_by_lua](#body_filter_by_lua) -* [body_filter_by_lua_file](#body_filter_by_lua_file) -* [log_by_lua](#log_by_lua) -* [log_by_lua_file](#log_by_lua_file) -* [lua_need_request_body](#lua_need_request_body) -* [lua_shared_dict](#lua_shared_dict) -* [lua_socket_connect_timeout](#lua_socket_connect_timeout) -* [lua_socket_send_timeout](#lua_socket_send_timeout) -* [lua_socket_send_lowat](#lua_socket_send_lowat) -* [lua_socket_read_timeout](#lua_socket_read_timeout) -* [lua_socket_buffer_size](#lua_socket_buffer_size) -* [lua_socket_pool_size](#lua_socket_pool_size) -* [lua_socket_keepalive_timeout](#lua_socket_keepalive_timeout) -* [lua_socket_log_errors](#lua_socket_log_errors) -* [lua_ssl_ciphers](#lua_ssl_ciphers) -* [lua_ssl_crl](#lua_ssl_crl) -* [lua_ssl_protocols](#lua_ssl_protocols) -* [lua_ssl_trusted_certificate](#lua_ssl_trusted_certificate) -* [lua_ssl_verify_depth](#lua_ssl_verify_depth) -* [lua_http10_buffering](#lua_http10_buffering) -* [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) -* [lua_transform_underscores_in_response_headers](#lua_transform_underscores_in_response_headers) -* [lua_check_client_abort](#lua_check_client_abort) -* [lua_max_pending_timers](#lua_max_pending_timers) -* [lua_max_running_timers](#lua_max_running_timers) - - -[Back to TOC](#table-of-contents) - -lua_use_default_type --------------------- -**syntax:** *lua_use_default_type on | off* - -**default:** *lua_use_default_type on* - -**context:** *http, server, location, location if* - -Specifies whether to use the MIME type specified by the [default_type](http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type) directive for the default value of the `Content-Type` response header. If you do not want a default `Content-Type` response header for your Lua request handlers, then turn this directive off. - -This directive is turned on by default. - -This directive was first introduced in the `v0.9.1` release. - -[Back to TOC](#directives) - -lua_code_cache --------------- -**syntax:** *lua_code_cache on | off* - -**default:** *lua_code_cache on* - -**context:** *http, server, location, location if* - -Enables or disables the Lua code cache for Lua code in `*_by_lua_file` directives (like [set_by_lua_file](#set_by_lua_file) and -[content_by_lua_file](#content_by_lua_file)) and Lua modules. - -When turning off, every request served by ngx_lua will run in a separate Lua VM instance, starting from the `0.9.3` release. So the Lua files referenced in [set_by_lua_file](#set_by_lua_file), -[content_by_lua_file](#content_by_lua_file), [access_by_lua_file](#access_by_lua_file), -and etc will not be cached -and all Lua modules used will be loaded from scratch. With this in place, developers can adopt an edit-and-refresh approach. - -Please note however, that Lua code written inlined within nginx.conf -such as those specified by [set_by_lua](#set_by_lua), [content_by_lua](#content_by_lua), -[access_by_lua](#access_by_lua), and [rewrite_by_lua](#rewrite_by_lua) will not be updated when you edit the inlined Lua code in your `nginx.conf` file because only the Nginx config file parser can correctly parse the `nginx.conf` -file and the only way is to reload the config file -by sending a `HUP` signal or just to restart Nginx. - -Even when the code cache is enabled, Lua files which are loaded by `dofile` or `loadfile` -in *_by_lua_file cannot be cached (unless you cache the results yourself). Usually you can either use the [init_by_lua](#init_by_lua) -or [init_by_lua_file](#init-by_lua_file) directives to load all such files or just make these Lua files true Lua modules -and load them via `require`. - -The ngx_lua module does not support the `stat` mode available with the -Apache `mod_lua` module (yet). - -Disabling the Lua code cache is strongly -discouraged for production use and should only be used during -development as it has a significant negative impact on overall performance. For example, the performance a "hello world" Lua example can drop by an order of magnitude after disabling the Lua code cache. - -[Back to TOC](#directives) - -lua_regex_cache_max_entries ---------------------------- -**syntax:** *lua_regex_cache_max_entries <num>* - -**default:** *lua_regex_cache_max_entries 1024* - -**context:** *http* - -Specifies the maximum number of entries allowed in the worker process level compiled regex cache. - -The regular expressions used in [ngx.re.match](#ngxrematch), [ngx.re.gmatch](#ngxregmatch), [ngx.re.sub](#ngxresub), and [ngx.re.gsub](#ngxregsub) will be cached within this cache if the regex option `o` (i.e., compile-once flag) is specified. - -The default number of entries allowed is 1024 and when this limit is reached, new regular expressions will not be cached (as if the `o` option was not specified) and there will be one, and only one, warning in the `error.log` file: - - - 2011/08/27 23:18:26 [warn] 31997#0: *1 lua exceeding regex cache max entries (1024), ... - - -Do not activate the `o` option for regular expressions (and/or `replace` string arguments for [ngx.re.sub](#ngxresub) and [ngx.re.gsub](#ngxregsub)) that are generated *on the fly* and give rise to infinite variations to avoid hitting the specified limit. - -[Back to TOC](#directives) - -lua_regex_match_limit ---------------------- -**syntax:** *lua_regex_match_limit <num>* - -**default:** *lua_regex_match_limit 0* - -**context:** *http* - -Specifies the "match limit" used by the PCRE library when executing the [ngx.re API](#ngxrematch). To quote the PCRE manpage, "the limit ... has the effect of limiting the amount of backtracking that can take place." - -When the limit is hit, the error string "pcre_exec() failed: -8" will be returned by the [ngx.re API](#ngxrematch) functions on the Lua land. - -When setting the limit to 0, the default "match limit" when compiling the PCRE library is used. And this is the default value of this directive. - -This directive was first introduced in the `v0.8.5` release. - -[Back to TOC](#directives) - -lua_package_path ----------------- - -**syntax:** *lua_package_path <lua-style-path-str>* - -**default:** *The content of LUA_PATH environ variable or Lua's compiled-in defaults.* - -**context:** *http* - -Sets the Lua module search path used by scripts specified by [set_by_lua](#set_by_lua), -[content_by_lua](#content_by_lua) and others. The path string is in standard Lua path form, and `;;` -can be used to stand for the original search paths. - -As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. - -[Back to TOC](#directives) - -lua_package_cpath ------------------ - -**syntax:** *lua_package_cpath <lua-style-cpath-str>* - -**default:** *The content of LUA_CPATH environment variable or Lua's compiled-in defaults.* - -**context:** *http* - -Sets the Lua C-module search path used by scripts specified by [set_by_lua](#set_by_lua), -[content_by_lua](#content_by_lua) and others. The cpath string is in standard Lua cpath form, and `;;` -can be used to stand for the original cpath. - -As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. - -[Back to TOC](#directives) - -init_by_lua ------------ - -**syntax:** *init_by_lua <lua-script-str>* - -**context:** *http* - -**phase:** *loading-config* - -Runs the Lua code specified by the argument `` on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file. - -When Nginx receives the `HUP` signal and starts reloading the config file, the Lua VM will also be re-created and `init_by_lua` will run again on the new Lua VM. In case that the [lua_code_cache](#lua_code_cache) directive is turned off (default on), the `init_by_lua` handler will run upon every request because in this special mode a standalone Lua VM is always created for each request. - -Usually you can register (true) Lua global variables or pre-load Lua modules at server start-up by means of this hook. Here is an example for pre-loading Lua modules: - -```nginx - -init_by_lua 'cjson = require "cjson"'; - -server { - location = /api { - content_by_lua ' - ngx.say(cjson.encode({dog = 5, cat = 6})) - '; - } -} -``` - -You can also initialize the [lua_shared_dict](#lua_shared_dict) shm storage at this phase. Here is an example for this: - -```nginx - -lua_shared_dict dogs 1m; - -init_by_lua ' - local dogs = ngx.shared.dogs; - dogs:set("Tom", 56) -'; - -server { - location = /api { - content_by_lua ' - local dogs = ngx.shared.dogs; - ngx.say(dogs:get("Tom")) - '; - } -} -``` - -But note that, the [lua_shared_dict](#lua_shared_dict)'s shm storage will not be cleared through a config reload (via the `HUP` signal, for example). So if you do *not* want to re-initialize the shm storage in your `init_by_lua` code in this case, then you just need to set a custom flag in the shm storage and always check the flag in your `init_by_lua` code. - -Because the Lua code in this context runs before Nginx forks its worker processes (if any), data or code loaded here will enjoy the [Copy-on-write (COW)](http://en.wikipedia.org/wiki/Copy-on-write) feature provided by many operating systems among all the worker processes, thus saving a lot of memory. - -Do *not* initialize your own Lua global variables in this context because use of Lua global variables have performance penalties and can lead to global namespace pollution (see the [Lua Variable Scope](#lua_variable_scope) section for more details). The recommended way is to use proper [Lua module](http://www.lua.org/manual/5.1/manual.html#5.3) files (but do not use the standard Lua function [module()](http://www.lua.org/manual/5.1/manual.html#pdf-module) to define Lua modules because it pollutes the global namespace as well) and call [require()](http://www.lua.org/manual/5.1/manual.html#pdf-require) to load your own module files in `init_by_lua` or other contexts ([require()](http://www.lua.org/manual/5.1/manual.html#pdf-require) does cache the loaded Lua modules in the global `package.loaded` table in the Lua registry so your modules will only loaded once for the whole Lua VM instance). - -Only a small set of the [Nginx API for Lua](#nginx-api-for-lua) is supported in this context: - -* Logging APIs: [ngx.log](#ngxlog) and [print](#print), -* Shared Dictionary API: [ngx.shared.DICT](#ngxshareddict). - -More Nginx APIs for Lua may be supported in this context upon future user requests. - -Basically you can safely use Lua libraries that do blocking I/O in this very context because blocking the master process during server start-up is completely okay. Even the Nginx core does blocking I/O (at least on resolving upstream's host names) at the configure-loading phase. - -You should be very careful about potential security vulnerabilities in your Lua code registered in this context because the Nginx master process is often run under the `root` account. - -This directive was first introduced in the `v0.5.5` release. - -[Back to TOC](#directives) - -init_by_lua_file ----------------- - -**syntax:** *init_by_lua_file <path-to-lua-script-file>* - -**context:** *http* - -**phase:** *loading-config* - -Equivalent to [init_by_lua](#init_by_lua), except that the file specified by `` contains the Lua code or [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -This directive was first introduced in the `v0.5.5` release. - -[Back to TOC](#directives) - -init_worker_by_lua ------------------- - -**syntax:** *init_worker_by_lua <lua-script-str>* - -**context:** *http* - -**phase:** *starting-worker* - -Runs the specified Lua code upon every Nginx worker process's startup when the master process is enabled. When the master process is disabled, this hook will just run after [init_by_lua*](#init_by_lua). - -This hook is often used to create per-worker reoccurring timers (via the [ngx.timer.at](#ngxtimerat) Lua API), either for backend healthcheck or other timed routine work. Below is an example, - -```nginx - -init_worker_by_lua ' - local delay = 3 -- in seconds - local new_timer = ngx.timer.at - local log = ngx.log - local ERR = ngx.ERR - local check - - check = function(premature) - if not premature then - -- do the health check or other routine work - local ok, err = new_timer(delay, check) - if not ok then - log(ERR, "failed to create timer: ", err) - return - end - end - end - - local ok, err = new_timer(delay, check) - if not ok then - log(ERR, "failed to create timer: ", err) - return - end -'; -``` - -This directive was first introduced in the `v0.9.5` release. - -[Back to TOC](#directives) - -init_worker_by_lua_file ------------------------ - -**syntax:** *init_worker_by_lua_file <lua-file-path>* - -**context:** *http* - -**phase:** *starting-worker* - -Similar to [init_worker_by_lua](#init_worker_by_lua), but accepts the file path to a Lua source file or Lua bytecode file. - -This directive was first introduced in the `v0.9.5` release. - -[Back to TOC](#directives) - -set_by_lua ----------- - -**syntax:** *set_by_lua $res <lua-script-str> [$arg1 $arg2 ...]* - -**context:** *server, server if, location, location if* - -**phase:** *rewrite* - -Executes code specified in `` with optional input arguments `$arg1 $arg2 ...`, and returns string output to `$res`. -The code in `` can make [API calls](#nginx-api-for-lua) and can retrieve input arguments from the `ngx.arg` table (index starts from `1` and increases sequentially). - -This directive is designed to execute short, fast running code blocks as the Nginx event loop is blocked during code execution. Time consuming code sequences should therefore be avoided. - -This directive is implemented by injecting custom commands into the standard [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s command list. Because [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) does not support nonblocking I/O in its commands, Lua APIs requiring yielding the current Lua "light thread" cannot work in this directive. - -At least the following API functions are currently disabled within the context of `set_by_lua`: - -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). -* Sleeping API function [ngx.sleep](#ngxsleep). - -In addition, note that this directive can only write out a value to a single Nginx variable at -a time. However, a workaround is possible using the [ngx.var.VARIABLE](#ngxvarvariable) interface. - -```nginx - -location /foo { - set $diff ''; # we have to predefine the $diff variable here - - set_by_lua $sum ' - local a = 32 - local b = 56 - - ngx.var.diff = a - b; -- write to $diff directly - return a + b; -- return the $sum value normally - '; - - echo "sum = $sum, diff = $diff"; -} -``` - -This directive can be freely mixed with all directives of the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html), [set-misc-nginx-module](http://github.com/openresty/set-misc-nginx-module), and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module) modules. All of these directives will run in the same order as they appear in the config file. - -```nginx - -set $foo 32; -set_by_lua $bar 'tonumber(ngx.var.foo) + 1'; -set $baz "bar: $bar"; # $baz == "bar: 33" -``` - -As from the `v0.5.0rc29` release, Nginx variable interpolation is disabled in the `` argument of this directive and therefore, the dollar sign character (`$`) can be used directly. - -This directive requires the [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) module. - -[Back to TOC](#directives) - -set_by_lua_file ---------------- -**syntax:** *set_by_lua_file $res <path-to-lua-script-file> [$arg1 $arg2 ...]* - -**context:** *server, server if, location, location if* - -**phase:** *rewrite* - -Equivalent to [set_by_lua](#set_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -Nginx variable interpolation is supported in the `` argument string of this directive. But special care must be taken for injection attacks. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by -switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. - -This directive requires the [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) module. - -[Back to TOC](#directives) - -content_by_lua --------------- - -**syntax:** *content_by_lua <lua-script-str>* - -**context:** *location, location if* - -**phase:** *content* - -Acts as a "content handler" and executes Lua code string specified in `` for every request. -The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). - -Do not use this directive and other content handler directives in the same location. For example, this directive and the [proxy_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass) directive should not be used in the same location. - -[Back to TOC](#directives) - -content_by_lua_file -------------------- - -**syntax:** *content_by_lua_file <path-to-lua-script-file>* - -**context:** *location, location if* - -**phase:** *content* - -Equivalent to [content_by_lua](#content_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by -switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. - -[Back to TOC](#directives) - -rewrite_by_lua --------------- - -**syntax:** *rewrite_by_lua <lua-script-str>* - -**context:** *http, server, location, location if* - -**phase:** *rewrite tail* - -Acts as a rewrite phase handler and executes Lua code string specified in `` for every request. -The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). - -Note that this handler always runs *after* the standard [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html). So the following will work as expected: - -```nginx - -location /foo { - set $a 12; # create and initialize $a - set $b ""; # create and initialize $b - rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; - echo "res = $b"; -} -``` - -because `set $a 12` and `set $b ""` run *before* [rewrite_by_lua](#rewrite_by_lua). - -On the other hand, the following will not work as expected: - -```nginx - -? location /foo { -? set $a 12; # create and initialize $a -? set $b ''; # create and initialize $b -? rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; -? if ($b = '13') { -? rewrite ^ /bar redirect; -? break; -? } -? -? echo "res = $b"; -? } -``` - -because `if` runs *before* [rewrite_by_lua](#rewrite_by_lua) even if it is placed after [rewrite_by_lua](#rewrite_by_lua) in the config. - -The right way of doing this is as follows: - -```nginx - -location /foo { - set $a 12; # create and initialize $a - set $b ''; # create and initialize $b - rewrite_by_lua ' - ngx.var.b = tonumber(ngx.var.a) + 1 - if tonumber(ngx.var.b) == 13 then - return ngx.redirect("/bar"); - end - '; - - echo "res = $b"; -} -``` - -Note that the [ngx_eval](http://www.grid.net.ru/nginx/eval.en.html) module can be approximated by using [rewrite_by_lua](#rewrite_by_lua). For example, - -```nginx - -location / { - eval $res { - proxy_pass http://foo.com/check-spam; - } - - if ($res = 'spam') { - rewrite ^ /terms-of-use.html redirect; - } - - fastcgi_pass ...; -} -``` - -can be implemented in ngx_lua as: - -```nginx - -location = /check-spam { - internal; - proxy_pass http://foo.com/check-spam; -} - -location / { - rewrite_by_lua ' - local res = ngx.location.capture("/check-spam") - if res.body == "spam" then - return ngx.redirect("/terms-of-use.html") - end - '; - - fastcgi_pass ...; -} -``` - -Just as any other rewrite phase handlers, [rewrite_by_lua](#rewrite_by_lua) also runs in subrequests. - -Note that when calling `ngx.exit(ngx.OK)` within a [rewrite_by_lua](#rewrite_by_lua) handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [rewrite_by_lua](#rewrite_by_lua) handler, calling [ngx.exit](#ngxexit) with status >= 200 (`ngx.HTTP_OK`) and status < 300 (`ngx.HTTP_SPECIAL_RESPONSE`) for successful quits and `ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)` (or its friends) for failures. - -If the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) directive is used to change the URI and initiate location re-lookups (internal redirections), then any [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) code sequences within the current location will not be executed. For example, - -```nginx - -location /foo { - rewrite ^ /bar; - rewrite_by_lua 'ngx.exit(503)'; -} -location /bar { - ... -} -``` - -Here the Lua code `ngx.exit(503)` will never run. This will be the case if `rewrite ^ /bar last` is used as this will similarly initiate an internal redirection. If the `break` modifier is used instead, there will be no internal redirection and the `rewrite_by_lua` code will be executed. - -The `rewrite_by_lua` code will always run at the end of the `rewrite` request-processing phase unless [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) is turned on. - -[Back to TOC](#directives) - -rewrite_by_lua_file -------------------- - -**syntax:** *rewrite_by_lua_file <path-to-lua-script-file>* - -**context:** *http, server, location, location if* - -**phase:** *rewrite tail* - -Equivalent to [rewrite_by_lua](#rewrite_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached and the Nginx config must be reloaded each time the Lua source file is modified. The Lua code cache can be temporarily disabled during development by switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. - -The `rewrite_by_lua_file` code will always run at the end of the `rewrite` request-processing phase unless [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) is turned on. - -[Back to TOC](#directives) - -access_by_lua -------------- - -**syntax:** *access_by_lua <lua-script-str>* - -**context:** *http, server, location, location if* - -**phase:** *access tail* - -Acts as an access phase handler and executes Lua code string specified in `` for every request. -The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). - -Note that this handler always runs *after* the standard [ngx_http_access_module](http://nginx.org/en/docs/http/ngx_http_access_module.html). So the following will work as expected: - -```nginx - -location / { - deny 192.168.1.1; - allow 192.168.1.0/24; - allow 10.1.1.0/16; - deny all; - - access_by_lua ' - local res = ngx.location.capture("/mysql", { ... }) - ... - '; - - # proxy_pass/fastcgi_pass/... -} -``` - -That is, if a client IP address is in the blacklist, it will be denied before the MySQL query for more complex authentication is executed by [access_by_lua](#access_by_lua). - -Note that the [ngx_auth_request](http://mdounin.ru/hg/ngx_http_auth_request_module/) module can be approximated by using [access_by_lua](#access_by_lua): - -```nginx - -location / { - auth_request /auth; - - # proxy_pass/fastcgi_pass/postgres_pass/... -} -``` - -can be implemented in ngx_lua as: - -```nginx - -location / { - access_by_lua ' - local res = ngx.location.capture("/auth") - - if res.status == ngx.HTTP_OK then - return - end - - if res.status == ngx.HTTP_FORBIDDEN then - ngx.exit(res.status) - end - - ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) - '; - - # proxy_pass/fastcgi_pass/postgres_pass/... -} -``` - -As with other access phase handlers, [access_by_lua](#access_by_lua) will *not* run in subrequests. - -Note that when calling `ngx.exit(ngx.OK)` within a [access_by_lua](#access_by_lua) handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [access_by_lua](#access_by_lua) handler, calling [ngx.exit](#ngxexit) with status >= 200 (`ngx.HTTP_OK`) and status < 300 (`ngx.HTTP_SPECIAL_RESPONSE`) for successful quits and `ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)` (or its friends) for failures. - -[Back to TOC](#directives) - -access_by_lua_file ------------------- - -**syntax:** *access_by_lua_file <path-to-lua-script-file>* - -**context:** *http, server, location, location if* - -**phase:** *access tail* - -Equivalent to [access_by_lua](#access_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid repeatedly reloading Nginx. - -[Back to TOC](#directives) - -header_filter_by_lua --------------------- - -**syntax:** *header_filter_by_lua <lua-script-str>* - -**context:** *http, server, location, location if* - -**phase:** *output-header-filter* - -Uses Lua code specified in `` to define an output header filter. - -Note that the following API functions are currently disabled within this context: - -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit) and [ngx.exec](#ngxexec)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). - -Here is an example of overriding a response header (or adding one if absent) in our Lua header filter: - -```nginx - -location / { - proxy_pass http://mybackend; - header_filter_by_lua 'ngx.header.Foo = "blah"'; -} -``` - -This directive was first introduced in the `v0.2.1rc20` release. - -[Back to TOC](#directives) - -header_filter_by_lua_file -------------------------- - -**syntax:** *header_filter_by_lua_file <path-to-lua-script-file>* - -**context:** *http, server, location, location if* - -**phase:** *output-header-filter* - -Equivalent to [header_filter_by_lua](#header_filter_by_lua), except that the file specified by `` contains the Lua code, or as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -This directive was first introduced in the `v0.2.1rc20` release. - -[Back to TOC](#directives) - -body_filter_by_lua ------------------- - -**syntax:** *body_filter_by_lua <lua-script-str>* - -**context:** *http, server, location, location if* - -**phase:** *output-body-filter* - -Uses Lua code specified in `` to define an output body filter. - -The input data chunk is passed via [ngx.arg](#ngxarg)[1] (as a Lua string value) and the "eof" flag indicating the end of the response body data stream is passed via [ngx.arg](#ngxarg)[2] (as a Lua boolean value). - -Behind the scene, the "eof" flag is just the `last_buf` (for main requests) or `last_in_chain` (for subrequests) flag of the Nginx chain link buffers. (Before the `v0.7.14` release, the "eof" flag does not work at all in subrequests.) - -The output data stream can be aborted immediately by running the following Lua statement: - -```lua - -return ngx.ERROR -``` - -This will truncate the response body and usually result in incomplete and also invalid responses. - -The Lua code can pass its own modified version of the input data chunk to the downstream Nginx output body filters by overriding [ngx.arg](#ngxarg)[1] with a Lua string or a Lua table of strings. For example, to transform all the lowercase letters in the response body, we can just write: - -```nginx - -location / { - proxy_pass http://mybackend; - body_filter_by_lua 'ngx.arg[1] = string.upper(ngx.arg[1])'; -} -``` - -When setting `nil` or an empty Lua string value to `ngx.arg[1]`, no data chunk will be passed to the downstream Nginx output filters at all. - -Likewise, new "eof" flag can also be specified by setting a boolean value to [ngx.arg](#ngxarg)[2]. For example, - -```nginx - -location /t { - echo hello world; - echo hiya globe; - - body_filter_by_lua ' - local chunk = ngx.arg[1] - if string.match(chunk, "hello") then - ngx.arg[2] = true -- new eof - return - end - - -- just throw away any remaining chunk data - ngx.arg[1] = nil - '; -} -``` - -Then `GET /t` will just return the output - - - hello world - - -That is, when the body filter sees a chunk containing the word "hello", then it will set the "eof" flag to true immediately, resulting in truncated but still valid responses. - -When the Lua code may change the length of the response body, then it is required to always clear out the `Content-Length` response header (if any) in a header filter to enforce streaming output, as in - -```nginx - -location /foo { - # fastcgi_pass/proxy_pass/... - - header_filter_by_lua 'ngx.header.content_length = nil'; - body_filter_by_lua 'ngx.arg[1] = string.len(ngx.arg[1]) .. "\\n"'; -} -``` - -Note that the following API functions are currently disabled within this context due to the limitations in NGINX output filter's current implementation: - -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit) and [ngx.exec](#ngxexec)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). - -Nginx output filters may be called multiple times for a single request because response body may be delivered in chunks. Thus, the Lua code specified by in this directive may also run multiple times in the lifetime of a single HTTP request. - -This directive was first introduced in the `v0.5.0rc32` release. - -[Back to TOC](#directives) - -body_filter_by_lua_file ------------------------ - -**syntax:** *body_filter_by_lua_file <path-to-lua-script-file>* - -**context:** *http, server, location, location if* - -**phase:** *output-body-filter* - -Equivalent to [body_filter_by_lua](#body_filter_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -This directive was first introduced in the `v0.5.0rc32` release. - -[Back to TOC](#directives) - -log_by_lua ----------- - -**syntax:** *log_by_lua <lua-script-str>* - -**context:** *http, server, location, location if* - -**phase:** *log* - -Run the Lua source code inlined as the `` at the `log` request processing phase. This does not replace the current access logs, but runs after. - -Note that the following API functions are currently disabled within this context: - -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). - -Here is an example of gathering average data for [$upstream_response_time](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_response_time): - -```nginx - -lua_shared_dict log_dict 5M; - -server { - location / { - proxy_pass http://mybackend; - - log_by_lua ' - local log_dict = ngx.shared.log_dict - local upstream_time = tonumber(ngx.var.upstream_response_time) - - local sum = log_dict:get("upstream_time-sum") or 0 - sum = sum + upstream_time - log_dict:set("upstream_time-sum", sum) - - local newval, err = log_dict:incr("upstream_time-nb", 1) - if not newval and err == "not found" then - log_dict:add("upstream_time-nb", 0) - log_dict:incr("upstream_time-nb", 1) - end - '; - } - - location = /status { - content_by_lua ' - local log_dict = ngx.shared.log_dict - local sum = log_dict:get("upstream_time-sum") - local nb = log_dict:get("upstream_time-nb") - - if nb and sum then - ngx.say("average upstream response time: ", sum / nb, - " (", nb, " reqs)") - else - ngx.say("no data yet") - end - '; - } -} -``` - -This directive was first introduced in the `v0.5.0rc31` release. - -[Back to TOC](#directives) - -log_by_lua_file ---------------- - -**syntax:** *log_by_lua_file <path-to-lua-script-file>* - -**context:** *http, server, location, location if* - -**phase:** *log* - -Equivalent to [log_by_lua](#log_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. - -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. - -This directive was first introduced in the `v0.5.0rc31` release. - -[Back to TOC](#directives) - -lua_need_request_body ---------------------- - -**syntax:** *lua_need_request_body <on|off>* - -**default:** *off* - -**context:** *main | server | location* - -**phase:** *depends on usage* - -Determines whether to force the request body data to be read before running rewrite/access/access_by_lua* or not. The Nginx core does not read the client request body by default and if request body data is required, then this directive should be turned `on` or the [ngx.req.read_body](#ngxreqread_body) function should be called within the Lua code. - -To read the request body data within the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable, -[client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) must have the same value as [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size). Because when the content length exceeds [client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) but less than [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size), Nginx will buffer the data into a temporary file on the disk, which will lead to empty value in the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable. - -If the current location includes [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) directives, -then the request body will be read just before the [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) code is run (and also at the -`rewrite` phase). Similarly, if only [content_by_lua](#content_by_lua) is specified, -the request body will not be read until the content handler's Lua code is -about to run (i.e., the request body will be read during the content phase). - -It is recommended however, to use the [ngx.req.read_body](#ngxreqread_body) and [ngx.req.discard_body](#ngxreqdiscard_body) functions for finer control over the request body reading process instead. - -This also applies to [access_by_lua](#access_by_lua) and [access_by_lua_file](#access_by_lua_file). - -[Back to TOC](#directives) - -lua_shared_dict ---------------- - -**syntax:** *lua_shared_dict <name> <size>* - -**default:** *no* - -**context:** *http* - -**phase:** *depends on usage* - -Declares a shared memory zone, ``, to serve as storage for the shm based Lua dictionary `ngx.shared.`. - -Shared memory zones are always shared by all the nginx worker processes in the current nginx server instance. - -The `` argument accepts size units such as `k` and `m`: - -```nginx - -http { - lua_shared_dict dogs 10m; - ... -} -``` - -See [ngx.shared.DICT](#ngxshareddict) for details. - -This directive was first introduced in the `v0.3.1rc22` release. - -[Back to TOC](#directives) - -lua_socket_connect_timeout --------------------------- - -**syntax:** *lua_socket_connect_timeout <time>* - -**default:** *lua_socket_connect_timeout 60s* - -**context:** *http, server, location* - -This directive controls the default timeout value used in TCP/unix-domain socket object's [connect](#tcpsockconnect) method and can be overridden by the [settimeout](#tcpsocksettimeout) method. - -The `