Questions tagged [openresty]

OpenResty (aka. ngx_openresty) is a full-fledged web application server by bundling the standard Nginx core, lots of 3rd-party Nginx modules, as well as most of their external dependencies.

OpenResty (aka. ngx_openresty) is a full-fledged web application server by bundling the standard Nginx core, lots of 3rd-party Nginx modules, as well as most of their external dependencies.

By taking advantage of various well-designed Nginx modules, OpenResty effectively turns the nginx server into a powerful web app server, in which the web developers can use the Lua programming language to script various existing nginx C modules and Lua modules and construct extremely high-performance web applications that are capable to handle 10K+ connections.

OpenResty aims to run your server-side web app completely in the Nginx server, leveraging Nginx's event model to do non-blocking I/O not only with the HTTP clients, but also with remote backends like MySQL, PostgreSQL, Memcached, and Redis.

OpenResty is not an Nginx fork. It is just a software bundle. Most of the patches applied to the Nginx core in OpenResty have already been submitted to the official Nginx team and most of the patches submitted have also been accepted. We are trying hard not to fork Nginx and always to use the latest best Nginx core from the official Nginx team.

Home: http://openresty.org/

474 questions
2
votes
1 answer

Nginx disable or decode url encoding when writing to access log

I have an open resty nginx with lua code that enhance the data and then I write this data to the access log for data analysis. The data that the lua code produce includes double quotes but nginx write it to the access log as \x22. Can I disable this…
Gluz
  • 3,154
  • 5
  • 24
  • 35
2
votes
0 answers

nginx unable to include ngx_http_sub_module with --with-http_sub_module

unable to include ngx_http_sub_module with --with-http_sub_module I am compiling (the openresty bundle https://github.com/openresty/ngx_openresty) with ./configure --with-luajit --with-http_sub_module make make install and in my config file I call…
Max L.
  • 9,774
  • 15
  • 56
  • 86
2
votes
1 answer

How to use Lua with Redis?

I am using Lua+nginx with OpenResty bundle. But problem comes when I try to connect Lua script with Redis, I'm not able to make successful connection. I have gone through a lot of links and blogs, But in the end it always fails. This is the snippet…
Rana Pratap Singh
  • 867
  • 12
  • 18
2
votes
2 answers

Openresty content_by_lua_file

I am trying to create basic hello word page in OpenResty. It works fine if I use content_by_lua, however when I trying to use content_by_lua_file I've got this error: 2015/01/22 13:52:35 [alert] 2183#0: lua_code_cache is off; this will hurt…
Lobster
  • 635
  • 2
  • 12
  • 30
2
votes
2 answers

How to do user level access control using nginx

I want to have nginx for user level access control to specific url, For other user , they are limited to access http://myserver.com/ (METHOD POST). like user larrycai can only POST to http://myserver.com/larrycai/xxx. I don't want to…
Larry Cai
  • 55,923
  • 34
  • 110
  • 156
2
votes
1 answer

Compile Lua scripts used on OpenResty

I'm currently using OpenResty + Lua for several projects, and I like the flexibility that Lua gives me, in fact I wrote some micro-web apps directly in Lua scripts, that are served by Nginx-OpenResty. But, if I want to distribute the web app,…
Carmine Giangregorio
  • 943
  • 2
  • 14
  • 35
2
votes
1 answer

Nginx-redis server setup 502 bad gateway error

on cloud VM I set this nginx.conf file with redis and openresty my_nginx.conf - worker_processes 1; error_log logs/error.log; events{ worker_connections 1024; } http { server { listen 8080; location / { redis2_query set…
pankaj udaas
  • 439
  • 2
  • 9
  • 14
2
votes
2 answers

openresty : problems with the init_by_lua directive (getting "directive is not allowed here")

I'm trying to use the init_by_lua directive : https://github.com/chaoslawful/lua-nginx-module#init_by_lua and nginx fails to start, with this message in the log : 2014/04/08 17:33:53 [emerg] 2105#0: "init_by_lua" directive is not allowed here in…
Max L.
  • 9,774
  • 15
  • 56
  • 86
1
vote
1 answer

"API disabled in the current context" error in OpenResty

I'm getting an error, "API disabled in the current context," when I use a Lua library, lua-resty-radixtree in OpenResty: ERROR: /usr/local/openresty/luajit/share/lua/5.1/resty/expr/v1.lua:319: API disabled in the current context stack traceback: …
1
vote
1 answer

why could not delete the nginx config when using openresty

I am using openresty openresty/1.21.4.1 as the web server,today I copied the nginx config from /etc/nginx/ to /usr/local/openresty/nginx/. Then I delete the config of nginx /etc/nginx/, but the web server could not access anymore. I using this…
Dolphin
  • 29,069
  • 61
  • 260
  • 539
1
vote
1 answer

Lua exact match line from file

So here is my scenario : I have nginx-lua config, that it contains json data (from POST request) : { "profile_name": "test", "number_from_json": "12", } In my /opt/file1.csv 1283813122344 12 12838138931316 128381383131 I have So I'm having…
Vancho
  • 25
  • 7
1
vote
1 answer

How do I set default headers for upstream responses in nginx?

I want to make sure that at least the default header value is always returned from upstream. Even if upstream is unavailable, which causes error 5xx. Now I have tried these nginx config options: server { ... #add_header…
deevroman
  • 99
  • 1
  • 2
  • 14
1
vote
1 answer

location mirroring is not working when used with nginx redirect

I'm trying to redirect a URL with nginx and at the same time, mirror the request to another location block. the mirror works fine when I use it with proxy_pass, but it doesn't work when used with nginx redirect location / { mirror /test …
1
vote
0 answers

Send message to RabbitMQ from OpenRest lua script

I'm trying to write a simple function with OpenResty, Redis and RabbitMQ. The use case is the following, we receive requests on /data?ip=x.x.x.x, and the parameter ip needs to be lookep up in a Redis database. If we find a value, we return it,…
Anthony Richir
  • 649
  • 2
  • 8
  • 31
1
vote
2 answers

Lua match start from the end

I am trying to extract url with match. I'm trying to find the filename after the "/" character. But url is always variable so i have to start from end 123, 123.py, 123.dat url://xxxxx/yyyyy/123 url://xxxxx/yyyyy/123.py url://xxxxx/yyyyy/123.dat I…
sweetngx
  • 67
  • 4