Hello!
On Wed, May 30, 2012 at 5:21 PM, Sparsh Gupta <spars...@gmail.com> wrote:
> We are using version control for configuring scrips of openresty
> (nginx) and our folder /usr/local/openresty/nginx/conf is under
> version control.
>
The best practice is to use a different directory than nginx's default
for your own projects. For example, your web site reside in the path,
say, /home/production/mysite/, then you have the following directory
layout under /home/production/mysite/:
conf/
nginx.conf
logs/
bin/
lua/
myapi.lua
mymodule.lua
And then you start nginx like this:
/path/to/nginx -p /home/production/mysite/ -c conf/nginx.conf
And in your conf/nginx.conf, you do not have to reference the absolute
path /home/production/mysite/, for example,
lua_package_path "$prefix/lua/?.lua;;";
lua_package_cpath "$prefix/lua/?.so;;";
server {
...
root html;
location /api {
content_by_lua_file lua/myapi.lua;
}
location /api2 {
content_by_lua '
local mymodule = require "mymodule"
...
';
}
}
> Every time we compile openresty, it adds extra files to the folder
> which we really dont want. We have
> /usr/local/openresty/nginx/confDefault where we keep the default
> configurations but we never use them. This is done because we are
> running openresty on multiple servers which got to be consistent
>
Please avoid putting stuffs into the installation directory of
ngx_openresty or Nginx. It is considered really bad practice.
You should really use separate installation path for your web
applications, and use packaging systems like RPM to deploy them to
multiple machines.
> Is there a configure parameter I can provide to avoid this and keep
> our confs clean. If not, whats the way around (If I will provide
> configuration path in configure), I assume it will push the default
> files at that location
See above.
Regards,
-agentzh