NGinx Default public www location?
I have worked with Apache before, so I am aware that the default public web root is typically /var/www/
.
I recently started working with nginx, but I can't seem to find the default public web root.
Where can I find the default public web root for nginx?
If installing on Ubuntu using apt-get, try /usr/share/nginx/www
.
EDIT:
On more recent versions the path has changed to:
/usr/share/nginx/html
2019 EDIT:
Might try in /var/www/html/index.nginx-debian.html
too.
If your configuration does not include a root /some/absolute/path;
statement, or it includes one that uses a relative path like root some/relative/path;
, then the resulting path depends on compile-time options.
Probably the only case that would allow you to make an educated guess as to what this means for you would be, if you downloaded and compiled the source yourself. In that case, the paths would be relative to whatever --prefix
was used. If you didn't change it, it defaults to /usr/local/nginx
. You can find the parameters nginx was compiled with via nginx -V
, it lists --prefix
as the first one.
Since the root
directive defaults to html
, this would, of course, result in /usr/local/nginx/html
being the answer to your question.
However, if you installed nginx in any other way, all bets are off. Your distribution might use entirely different default paths. Learning to figure out what kind of defaults your distribution of choice uses for things is another task entirely.
The default Nginx directory on Debian is /var/www/nginx-default
.
You can check the file: /etc/nginx/sites-enabled/default
and find
server {
listen 80 default;
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/nginx-default;
index index.html index.htm;
}
The root is the default location.