worker_processes 8;

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" "$upstream_status" $request_body';

    access_log  /home/logs/nginx/mallaccess.log  main;
    error_log /home/logs/nginx/mallerror.log debug;
sendfile        on;
keepalive_timeout  65;

server {
    listen       80;
    server_name  mapi.wanlitong.com;
            include /usr/local/openresty/nginx/conf/lua/*.conf;
            root /data;
            location ~* /mobileapi/m2s/pointsmall/queryProdInfo.do {
                    error_page 404 @errorjump;
            }
            location @errorjump {
                rewrite_by_lua '
                            ngx.req.read_body()
                            local a = ngx.req.get_post_args()["goodsId"]
                            local b = ngx.req.get_post_args()["repositoryId"]
                            function Sleep(n)
                               os.execute("sleep " .. n)
                            end
                            ngx.redirect("http://mapi.wanlitong.com/"..a..b..".json")
                    ';
            }
}

}