Hopefully I can help you out a bit!
If you aren't quite sure of what you can do with Nginx's configuration files,
the Nginx wiki is a great place to find out.
The
include directive allows you to include several configuration files, so you can split application logic into several files so that it won't become convoluted.
I am no expert, but generally doing things like querying a database should be left to the Nginx configuration and things like text manipulation, templating, authentication, etc. should be left to Lua.
Subrequests sometimes slow things down, so try avoiding them when you are able. Also, all Lua code is cached by default, although this can be turned off.
Sharing commonly used functions among different locations in Nginx can be achieved by writing a module in Lua and then using the 'require' function in Lua to import the module. This code is shared in the current Nginx module and helps preserve memory.
I may be wrong on some things, but this is what I have gathered from my work with Nginx.
Respectfully,
Chase
On Friday, August 31, 2012 5:25:24 AM UTC+2, Maanas wrote:
Thanks for detailed reply.
1. One thing good to note that my direction is correct in which i m trying to build the application stack.
2. I need to work on the encrypted session and put in place the working prototype to see how it actually interface with php.
3. One thing is to prevent twisted and lengthy nginx.conf files.
I do not understand this completely. I m sure debugging a ngnix.conf file would be complex as the application grows especially with not much understanding of the nginx internals.
What i m working on is to split each group of end points into separate conf file and include. That way each conf file will be like one mini script for lua. Further, i m also thinking go use location { internal } to map common used functions / objects and lua to incapsulate the business logic. And then used sub request to actually process them. Further, this will also cache all the lua into ngnix. Yes i plan to use drizzle + rds_json. I saw the performance bench mark in one of your presentation. The idea of putting all this in intermal end point is to encapsulate the business logic. Do you see any problem with this approach.
4. Thanks for the example. This will help me to go further.
regards,