new to web

Francis Daly francis at
Fri Nov 29 23:27:57 UTC 2013

On Fri, Nov 29, 2013 at 04:59:24PM +0000, Matthew Ngaha wrote:

Hi there,

One of the best things you can learn about is your server error log.

Read that, and it should tell you why nginx thinks something failed,
every time.

> Location blocks. Is the idea here to have as many location blocks as
> you have web pages?

The documentation for the directive "location" is at

Briefly, when a request comes in, nginx picks only one location to
process it, and nginx does whatever that location says.

The default action is "serve a file from the filesystem". So if all you
want to do is send files from the filesystem, you don't need any location;
or you can use one location that will match all requests.

> i put a file
> "flood.jpg" inside my default root location (below) but i get
> permission denied when trying to access the file on my web browser.

What does the error log say?

It should tell you which file nginx tried to open, and it should tell
you why it failed.

(My guess is "Permission denied", which indicates that the user that
nginx runs as does not have permission to read the file. If that is the
case, you will want to change something about your system -- possibly
the method by which you put the file there, or possibly the user account
that nginx runs as.)

> This is also permission denied, but i want to ask. Is it ok accessing
> files like this or would it be better to make a specific location
> block for them, like:

>From the list of location blocks that you have, you should be able to
say which one will be used for each request that is made.

I tend to have one location block for one different type of request
-- and all requests of the form "serve from the filesystem below
/usr/local/nginx/html" are the same type.

Francis Daly        francis at

More information about the nginx mailing list