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?
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:
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.
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.
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:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.