Re: How to config the path for the dynamic module of nginx to access?
Hello! On Thu, Dec 01, 2016 at 10:08:55AM -0800, Ya-wen Lin wrote: > Thanks for your reply. > I've already have > load_module /usr/local/etc/nginx/ngx_http_my_module.so; > in nginx.conf > But that "ngx_http_my_module.so" will write out some files, I'd like to > config the path for those generated files. > Currently the path seems to be the working folder I start nginx service. If you use paths in your module you are expected to handle them much like the nginx itself, depending on context: - either relative to prefix, like load_module does; - or relative to conf prefix, like include does; - or relative to document root, like serving static files. First two variants are usually handled at configuration parsing time using the ngx_conf_full_name() function. Last one is usually done with the ngx_http_map_uri_to_path() function. -- Maxim Dounin http://nginx.org/ ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: How to config the path for the dynamic module of nginx to access?
Thanks for your reply. I've already have load_module /usr/local/etc/nginx/ngx_http_my_module.so; in nginx.conf But that "ngx_http_my_module.so" will write out some files, I'd like to config the path for those generated files. Currently the path seems to be the working folder I start nginx service. On Thu, Dec 1, 2016 at 6:14 AM, Maxim Dounin wrote: > Hello! > > On Wed, Nov 30, 2016 at 12:15:46PM -0800, Ya-wen Lin wrote: > > > Hi, > > > > I've read the related documents and tried googling but the results are > all > > about how to assign the path to the module's implementation c code for > > nginx to compile a module. > > > > My module will read/write files upon end-user's request, and my question > is > > how to set the path so that my module will directly read/write in that > > directory. > > > > I found that without extra settings, my module will read/write the > folder I > > initiate nginx. For example, if I run sudo nginx where pwd is /Users/me/ > > html/data, then the dynamic module will read/write files from > > /Users/me/html/data. > > > > What would be the best practice to set the path to access data for my > > module? > > Paths to modules as specified in the load_module directive are > resolved from --prefix as set during ./configure, much like many > other paths in nginx. > > -- > Maxim Dounin > http://nginx.org/ > > ___ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx > ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: How to config the path for the dynamic module of nginx to access?
Hello! On Wed, Nov 30, 2016 at 12:15:46PM -0800, Ya-wen Lin wrote: > Hi, > > I've read the related documents and tried googling but the results are all > about how to assign the path to the module's implementation c code for > nginx to compile a module. > > My module will read/write files upon end-user's request, and my question is > how to set the path so that my module will directly read/write in that > directory. > > I found that without extra settings, my module will read/write the folder I > initiate nginx. For example, if I run sudo nginx where pwd is /Users/me/ > html/data, then the dynamic module will read/write files from > /Users/me/html/data. > > What would be the best practice to set the path to access data for my > module? Paths to modules as specified in the load_module directive are resolved from --prefix as set during ./configure, much like many other paths in nginx. -- Maxim Dounin http://nginx.org/ ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx