Permalink
Browse files

beta

  • Loading branch information...
1 parent f346373 commit f7b4cc0826fcd972f12cefc6be0147f552ecb958 @alacner committed Apr 28, 2011
Showing with 336 additions and 174 deletions.
  1. +162 −3 config
  2. +129 −3 nginx.conf
  3. 0 { → src}/ddebug.h
  4. +12 −168 { → src}/ngx_http_lua_module.c
  5. +33 −0 test.lua
View
165 config
@@ -1,4 +1,163 @@
+ngx_feature="lua library"
+ngx_feature_libs="-llua -lm"
+ngx_feature_name=
+ngx_feature_run=no
+ngx_feature_incs="#include <lauxlib.h>"
+ngx_feature_path=
+ngx_feature_test="(void) luaL_newstate();"
+
+if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
+ # explicit set lua lib path
+ ngx_feature="LuaJIT library in $LUAJIT_LIB and $LUAJIT_INC (specified by the LUAJIT_LIB and LUAJIT_INC env)"
+ ngx_feature_path="$LUAJIT_INC"
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R$LUAJIT_LIB -L$LUAJIT_LIB -lluajit-5.1 -lm"
+ else
+ ngx_feature_libs="-L$LUAJIT_LIB -lluajit-5.1 -lm"
+ fi
+
+ . auto/feature
+
+ if [ $ngx_found = no ]; then
+ cat << END
+ $0: error: the ngx_lua addon requires the lua or luajit library and LUAJIT_LIB is defined as $LUAJIT_LIB and LUAJIT_INC $LUAJIT_INC, but we cannot find LuaJIT there.
+END
+ exit 1
+ fi
+
+ case "$NGX_PLATFORM" in
+ Darwin:*)
+ case "$NGX_MACHINE" in
+ amd64 | x86_64 | i386)
+ echo "adding extra linking options needed by LuaJIT"
+ ngx_feature_libs="$ngx_feature_libs -pagezero_size 10000 -image_base 100000000"
+ ;;
+
+ *)
+ ;;
+ esac
+ ;;
+
+ *)
+ ;;
+ esac
+else
+ if [ -n "$LUA_INC" -o -n "$LUA_LIB" ]; then
+ # explicit set lua lib path
+ ngx_feature="lua library in $LUA_LIB and $LUA_INC (specified by the LUA_LIB and LUA_INC env)"
+ ngx_feature_path="$LUA_INC"
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R$LUA_LIB -L$LUA_LIB -llua -lm"
+ else
+ ngx_feature_libs="-L$LUA_LIB -llua -lm"
+ fi
+
+ . auto/feature
+
+ if [ $ngx_found = no ]; then
+ cat << END
+ $0: error: the ngx_lua addon requires the lua or luajit library and LUA_LIB is defined as $LUA_LIB and LUA_INC is $LUA_INC, but we cannot find standard Lua there.
+END
+ exit 1
+ fi
+ else
+ # auto-discovery
+ ngx_feature="lua library"
+ ngx_feature_libs="-llua -lm"
+ . auto/feature
+
+ if [ $ngx_found = no ]; then
+ # OpenBSD
+ ngx_feature="lua library in /usr/local/"
+ ngx_feature_path="/usr/local/include"
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -llua -lm"
+ else
+ ngx_feature_libs="-L/usr/local/lib -llua -lm"
+ fi
+ . auto/feature
+ fi
+
+ if [ $ngx_found = no ]; then
+ # NetBSD
+ ngx_feature="lua library in /usr/pkg/"
+ ngx_feature_path="/usr/pkg/include/"
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lm -llua"
+ else
+ ngx_feature_libs="-L/usr/pkg/lib -lm -llua"
+ fi
+ . auto/feature
+ fi
+
+ if [ $ngx_found = no ]; then
+ # MacPorts
+ ngx_feature="lua library in /opt/local/"
+ ngx_feature_path="/opt/local/include"
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lm -llua"
+ else
+ ngx_feature_libs="-L/opt/local/lib -lm -llua"
+ fi
+ . auto/feature
+ fi
+
+ if [ $ngx_found = no ]; then
+ # FreeBSD
+ ngx_feature="lua library in /usr/local/../lua51/"
+ ngx_feature_path="/usr/local/include/lua51"
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/usr/local/lib/lua51 -L/usr/local/lib/lua51 -llua -lm"
+ else
+ ngx_feature_libs="-L/usr/local/lib/lua51 -llua -lm"
+ fi
+ . auto/feature
+ fi
+
+ if [ $ngx_found = no ]; then
+ # Debian
+ ngx_feature="lua library in /usr/"
+ ngx_feature_path="/usr/include/lua5.1"
+ if [ $NGX_RPATH = YES ]; then
+ ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -llua5.1"
+ else
+ ngx_feature_libs="-L/usr/lib -lm -llua5.1"
+ fi
+ . auto/feature
+ fi
+ fi
+fi
+
+if [ $ngx_found = yes ]; then
+ CORE_INCS="$CORE_INCS $ngx_feature_path"
+ CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
+else
+ cat << END
+ $0: error: the ngx_lua addon requires the lua library.
+END
+ exit 1
+fi
+
ngx_addon_name=ngx_http_lua_module
-HTTP_MODULES="$HTTP_MODULES ngx_http_lua_module"
-NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_lua_module.c"
-CORE_LIBS="$CORE_LIBS -llua -lm"
+HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_lua_module"
+NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ngx_http_lua_module.c"
+NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_addon_dir/src/ddebug.h"
+CFLAGS="$CFLAGS -DNDK_SET_VAR"
+
+ngx_feature="export symbols by default"
+ngx_feature_libs="-Wl,-E"
+ngx_feature_name=
+ngx_feature_run=no
+ngx_feature_incs="#include <stdio.h>"
+ngx_feature_path=
+ngx_feature_test='printf("hello");'
+
+. auto/feature
+
+if [ $ngx_found = yes ]; then
+ CORE_LIBS="-Wl,-E $CORE_LIBS"
+fi
+
+USE_MD5=YES
+
+
View
@@ -1,4 +1,130 @@
- location /lua {
- ngx_lua_module;
- lua 1234;
+
+#user nobody;
+daemon off;
+worker_processes 1;
+master_process off;
+#error_log logs/error.log debug;
+#error_log logs/error.log;
+#error_log logs/error.log notice;
+#error_log logs/error.log info;
+
+#pid logs/nginx.pid;
+
+
+events {
+ worker_connections 1024;
+}
+
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+
+ #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ # '$status $body_bytes_sent "$http_referer" '
+ # '"$http_user_agent" "$http_x_forwarded_for"';
+
+ #access_log logs/access.log main;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ #keepalive_timeout 0;
+ keepalive_timeout 65;
+
+ #gzip on;
+
+ server {
+ listen 80;
+ server_name localhost;
+ access_log /tmp/access.log;
+ error_log /tmp/error.log debug;
+
+ #charset koi8-r;
+
+ #access_log logs/host.access.log main;
+
+ location / {
+ root html;
+ index index.html index.htm;
}
+
+
+location =/lua {
+default_type 'text/plain';
+ngx_lua_module;
+lua "conf/lua_test.lua";
+}
+
+
+ #error_page 404 /404.html;
+
+ # redirect server error pages to the static page /50x.html
+ #
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root html;
+ }
+
+ # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+ #
+ #location ~ \.php$ {
+ # proxy_pass http://127.0.0.1;
+ #}
+
+ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+ #
+ #location ~ \.php$ {
+ # root html;
+ # fastcgi_pass 127.0.0.1:9000;
+ # fastcgi_index index.php;
+ # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
+ # include fastcgi_params;
+ #}
+
+ # deny access to .htaccess files, if Apache's document root
+ # concurs with nginx's one
+ #
+ #location ~ /\.ht {
+ # deny all;
+ #}
+ }
+
+
+ # another virtual host using mix of IP-, name-, and port-based configuration
+ #
+ #server {
+ # listen 8000;
+ # listen somename:8080;
+ # server_name somename alias another.alias;
+
+ # location / {
+ # root html;
+ # index index.html index.htm;
+ # }
+ #}
+
+
+ # HTTPS server
+ #
+ #server {
+ # listen 443;
+ # server_name localhost;
+
+ # ssl on;
+ # ssl_certificate cert.pem;
+ # ssl_certificate_key cert.key;
+
+ # ssl_session_timeout 5m;
+
+ # ssl_protocols SSLv2 SSLv3 TLSv1;
+ # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
+ # ssl_prefer_server_ciphers on;
+
+ # location / {
+ # root html;
+ # index index.html index.htm;
+ # }
+ #}
+
+}
File renamed without changes.
Oops, something went wrong.

0 comments on commit f7b4cc0

Please sign in to comment.