Good Directive vs Bad Directives

Hello fellas,

I’ve read on Pitfalls and Common Mistakes | NGINX, what the different between
bad
and good? Any info related to this issue? Such as cpu load or mem load?

bump

On Tue, Apr 24, 2012 at 08:30:18AM -0700, antituhan wrote:

Hi there,

I’ve read on Pitfalls and Common Mistakes | NGINX, what the different between bad
and good? Any info related to this issue? Such as cpu load or mem load?

The short version is: if you don’t understand them, just don’t do the
bad ones.

The more useful information is:

that’s a wiki, so what I see when I read it now may not be what you saw
when you read it. And it might be different tomorrow. And I’m not going
to help the archaeologists by being explicit :wink:

But reading that page right now, the first item seems described as a
possible configuration maintainability problem; the second item seems
the same – basically “don’t repeat what you don’t need to repeat”;
the third item is described as processor-inefficient; the fourth item
doesn’t say why but just says “use try_files”.

Is any specific one unclear to you?

f

Francis D. [email protected]

Hi Francis, thanks for the response,

Ok, basicly it’s just a different directive (simple and ‘crowded’
directive), isn’t it ? And it doesn’t matter with cpu/mem load (such as
we
simply could use “try_files” than “if”). So, the conclusion is that “if”
directive is same as “try_files”, the different is only on the
simplicity,
and it’s not causing cpu/mem high load, right?

On Tue, 2012-05-01 at 18:34 -0700, antituhan wrote:

Hi Francis, thanks for the response,

Ok, basicly it’s just a different directive (simple and ‘crowded’
directive), isn’t it ? And it doesn’t matter with cpu/mem load (such as we
simply could use “try_files” than “if”). So, the conclusion is that “if”
directive is same as “try_files”, the different is only on the simplicity,
and it’s not causing cpu/mem high load, right?

Cliff

Ok thanks francis, got that point :slight_smile: If “try_files” can do, we don’t
need
using “if”, and if “try_files” can’t do, we just insert “if” directive
(only
if very needed). Isn’t it ?

Francis D. wrote

On Tue, May 01, 2012 at 06:34:57PM -0700, antituhan wrote:

Hi there,

Ok, basicly it’s just a different directive (simple and ‘crowded’
directive), isn’t it ?

It’s a different directive, that does different things.

So, the conclusion is that “if”
directive is same as “try_files”, the different is only on the simplicity,
and it’s not causing cpu/mem high load, right?

“if” can do a lot more than try_files, but has its own pitfalls when
used within location{}.

If what you want is “if this file exists, process it; otherwise do this
other thing”, that is what try_files is for.

f

Francis D. [email protected]

On Thu, May 03, 2012 at 06:04:07AM -0700, antituhan wrote:

Hi there,

Ok thanks francis, got that point :slight_smile: If “try_files” can do, we don’t need
using “if”, and if “try_files” can’t do, we just insert “if” directive (only
if very needed). Isn’t it ?

More or less, yes.

Use the right tool for the task. Sometimes try_files is the right one,
sometimes it isn’t.

f

Francis D. [email protected]