Not update configuration folder while installing a new make

17 views
Skip to first unread message

Sparsh Gupta

unread,
May 30, 2012, 5:21:26 AM5/30/12
to open...@googlegroups.com
We are using version control for configuring scrips of openresty
(nginx) and our folder /usr/local/openresty/nginx/conf is under
version control.

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

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

Thanks
Sparsh Gupta

agentzh

unread,
May 30, 2012, 5:32:35 AM5/30/12
to open...@googlegroups.com
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

Sparsh Gupta

unread,
Jun 1, 2012, 3:58:32 PM6/1/12
to open...@googlegroups.com
Hello

> 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
>

Thanks for the suggestion. I did exactly like this and passed the
required paths at configuration time only. What I also did is added
the following compile time options:
--without-http_fastcgi_module --without-http_uwsgi_module
--without-http_scgi_module --without-http_charset_module \

I found that prefix (--prefix=/var/www/dev) directory also had the
following files:

fastcgi.conf
fastcgi.conf.default
fastcgi_params
fastcgi_params.default
koi-utf
koi-win
scgi_params
scgi_params.default
uwsgi_params
uwsgi_params.default
win-utf

Ideally, if I have disabled all these modules and built my server
without these supports, there is no point including these file
templates. I understand there is no harm from these files, but still,
clean is better :)

agentzh

unread,
Jun 1, 2012, 9:03:58 PM6/1/12
to open...@googlegroups.com
Hello!

On Sat, Jun 2, 2012 at 3:58 AM, Sparsh Gupta <spars...@gmail.com> wrote:
>
> Thanks for the suggestion. I did exactly like this and passed the
> required paths at configuration time only.

No, that's wrong. That's not I was saying. The -p option I mentioned
earlier is for run-time (i.e., starting any existing nginx build,
including those not built by yourself), not build-time (or in your
term, "configuration time").

> What I also did is added
> the following compile time options:
> --without-http_fastcgi_module --without-http_uwsgi_module
> --without-http_scgi_module --without-http_charset_module \
>
> I found that prefix (--prefix=/var/www/dev) directory also had the
> following files:
>
> fastcgi.conf
> fastcgi.conf.default
> fastcgi_params
> fastcgi_params.default
> koi-utf
> koi-win
> scgi_params
> scgi_params.default
> uwsgi_params
> uwsgi_params.default
> win-utf
>

It seems that you specified your path while calling ./configure for
nginx, so nginx will install its default files into the path that you
specify. That's certainly not what you want.

You should instead override your server prefix at *every* single run
of your existing nginx build by starting your nginx using the -p
option (note, not the --prefix option passed to ./configure), like
this:

nginx -p /some/arbitrary/path/

Then your /some/arbitrary/path/ will stay clean.

Regards,
-agentzh

Sparsh Gupta

unread,
Jun 4, 2012, 3:11:20 AM6/4/12
to open...@googlegroups.com
Thanks for adding more information

Sparsh Gupta
> --
> 邮件自: 列表"openresty",专用于技术讨论!
> 发言: 请发邮件到 open...@googlegroups.com
> 退订: 请发邮件至 openresty+...@googlegroups.com
> 详情: http://groups.google.com/group/openresty
> 官网: http://openresty.org/
> 仓库: https://github.com/agentzh/ngx_openresty
> 建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
> 教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
Reply all
Reply to author
Forward
0 new messages