I am a newbie to nginx. I have done some initial research on nginx architecture, location modules, upstream modules, third party modules available for various purposes etc. After going through a number of pages I have a question which I can't seem to find an easy answer to.
I have a very simple use case like this: user enters a set of keywords to search on my web site. In the backend, in my nginx location module, i first go to Redis for cached results against the set of keywords and if not found, to Sphinx search daemon. In the latter case, I set the results obtained from Sphinx back into Redis.
I have thought of the following design, in terms of nginx modules I would use:
1 My main location module that picks the keywords entered and communicates to Redis and Sphinx2 For communicating to Redis I thought of using HttpRedis2Module (http://wiki.nginx.org/HttpRedis2Module)3 For communicating with Sphinx, I am trying to write a simple C++ client or adapt the Sphinx C++ client (http://sourceforge.net/projects/cppsphinxclient/) or its parts into an upstream module.
What I wanted to know is how to invoke the upstream modules within my main location module. Are there standard APIs provided by Nginx for the same and do they retain the async advantages? Or do I have to resort to make curl calls from my C++ client and use the response? I was hoping that the former (Nginx APIs to call upstream modules) exists in some form and serves as some "shortcut" or "faster" way/alternative to making some curl API calls.
I have developed an upstream module for Sphinx2 search platform. It's available at: https://github.com/reeteshranjan/sphinx2-nginx-module
It talks to Sphinx2 searchd component for performing search. It's in infant stage right now and more work is needed to get to production ready. I am working on it. In case any one is interested in working with me on this module, please let me know.
If you are looking to play with it, it is built and installed like any other third party module using the source available at link provided above.
Hi, this is a new patch for uwsgi over ssl support aimed at nginx 1.5.x
It now exposes 4 options:
Roberto De Ioris
While reading through the source code for nginx I came across the following two lines in ngx_config.h
#define NGX_INT32_LEN (sizeof("-2147483648") - 1)
#define NGX_INT64_LEN (sizeof("-9223372036854775808") - 1)
I was wondering if someone could explain the intention of these lines to me because it is not clear. My understanding is that using sizeof() on a string will return the number of characters in that string. Conversely, I get the feeling these lines are supposed to somehow act as replacements for INT32_MAX and INT64_MAX in stdint.h.
Looking at code where these #define’s are used doesn’t really help clarify things either. For example, in nginx.c there is:
var = ngx_alloc(sizeof(NGINX_VAR)
+ cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
The code clearly allocates memory, but it’s not clear why the allocation is a multiple of NGX_INT32_LEN (or why we’re adding 1, or 2 for that matter).
Any direction would be much appreciated.