Nginx module development related query

Sumeet Chhetri sumeet.chhetri at
Fri Sep 16 09:48:43 UTC 2016

Hi All,

I have been working on developing an nginx module for one of my c++ web
framework and in the process have also read a lot of nginx blogs to
understand and come up with an nginx module of my own for my framework. I
had a small query related to serving static files within a module handler.

So the query is, I have the below mentioned nginx configuration,

location ~ ^/(.+?)(/.*)?$ {
            ffeadcpp_path /home/vagrant/ffead-cpp/ffead-cpp-2.0-bin/;

my framework web root is

It has multiple sites/context-roots within

I want all requests to be handled by my custom module, within the module I
handle all roots and also separate dynamic requests from static requests
and handle all dynamic requests using my framework logic.

every site/folder/context has static files within the public folder, for eg,

I have reached a point and written a module which handles dynamic requests
and serves them successfully but now I want nginx to handle static file
processing instead of doing it myself. Is there a way to just change the
request uri with an actual file location in this case to,
whenever a request for a static files arises according to the context root,
In my module I separate the dynamic and static requests.
Right now i'm returning NGX_DONE from my static file handling block, I have
even tried NGX_DECLINED but to no avail.

So in my module, I do,

if(not static file)

process it using my framework


?? -- let nginx handle the static request, change the uri to add the
ffeadcpp_path path prefix, along with the public suffix and the context
root, signal nginx that this static request needs to be handled by nginx

The source code for the module is located at

Any help would be greatly appreciated.

Sumeet Chhetri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list