Finding docroot directory?

Hello

I’m running Nginx 1.4.1 on an appliance running Debian 6, and can’t find
from which directory Nginx is serving files.

According to /etc/nginx.conf, the location for “/” is “root
/var/www;”,
but even renaming the default index.html still displays the familiar
“Welcome to nginx!”.

After using “apt-get upgrade” to upgrade from 1.2.? to 1.4.1, I ran
“/etc/init.d/nginx restart” just in case, but it made no difference.

Is there a way to have Nginx tell from where it’s serving files?

Thank you.

Posted at Nginx Forum:

I found a work-around: Reading “/var/log/nginx/error.log” includes a
warning
that Nginx can’t find “/usr/share/nginx/html/favicon.ico”, so for some
reason, Nginx uses /usr/share/nginx/html/ instead of /var/www.

I’m confused about the multiple configuration files used by Nginx:

/etc/nginx.conf
/etc/conf.d/
/etc/sites-available/
/etc/sites-enabled/

Why are there more than one?

Thank you.

Posted at Nginx Forum:

This Ars Technica article is where I learned how to use nginx. Lee
Hutchinson does a good job explaining all that.

On Mon, May 13, 2013 at 06:56:11AM -0400, Shohreh wrote:

Hi there,

I’m running Nginx 1.4.1 on an appliance running Debian 6, and can’t find
from which directory Nginx is serving files.

If “nginx -V” doesn’t tell you, and the log files don’t tell you, then
you can do something like

location = /docroot-test {
return 200 “docroot is $document_root\n”;
}

followed by

curl -i http://localhost/docroot-test

You’ll need to make sure that the new location{} is in the server{}
that will handle this request, of course, but it’s hard to argue with
asking the server itself what directory it is looking in.

Any other location{} block might have a different “root” or “alias”
defined, but that should be clear from the config file.

f

Francis D. [email protected]

On Mon, May 13, 2013 at 07:02:14AM -0400, Shohreh wrote:

Hi there,

I’m confused about the multiple configuration files used by Nginx:

/etc/nginx.conf
/etc/conf.d/
/etc/sites-available/
/etc/sites-enabled/

Why are there more than one?

nginx uses exactly one – the one named in the “-c” argument when run,
or else the compiled-in value.

That one file may use the “include” directive to read in other files,
if the administrator thinks that this is more useful to them.

And if you’re not running the equivalent of
“/usr/local/nginx/sbin/nginx”,
then whatever startup sequence you are running might introduce its own
“-c” argument. That’s up to the administrator, and not nginx.

f

Francis D. [email protected]

Thanks everyone for the infos. “nginx -V” doesn’t say where the docroot
is,
but I noticed that /etc/nginx/nginx.conf does use
“/etc/nginx/conf.d/*.conf”, where default.conf says:

location / {
        root   /usr/share/nginx/html

Thank you.

Posted at Nginx Forum: