Nginx 默认公共 www 位置? [英] NGinx Default public www location?

查看:25
本文介绍了Nginx 默认公共 www 位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前使用过 Apache,所以我知道默认的公共 Web 根目录通常是 /var/www/.

I have worked with Apache before, so I am aware that the default public web root is typically /var/www/.

我最近开始使用 nginx,但我似乎找不到默认的公共 Web 根目录.

I recently started working with nginx, but I can't seem to find the default public web root.

在哪里可以找到 nginx 的默认公共 Web 根目录?

Where can I find the default public web root for nginx?

推荐答案

如果您的配置不包含 root/some/absolute/path; 语句,或者包含使用相对路径的语句像 root some/relative/path;,那么生成的路径取决于编译时选项.

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.

如果您 下载 并自己编译源代码.在这种情况下,路径将与使用的任何 --prefix 相关.如果你没有改变它,它默认为 /usr/local/nginx.你可以通过nginx -V找到nginx编译的参数,它把--prefix列为第一个.

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.

由于 root指令默认为 html,这当然会导致 /usr/local/nginx/html 成为您问题的答案.

Since the root directive defaults to html, this would, of course, result in /usr/local/nginx/html being the answer to your question.

但是,如果您以任何其他方式安装了 nginx,那么一切都将失败.您的发行版可能使用完全不同的默认路径.学习弄清楚你的选择分布为事物使用什么样的默认值完全是另一项任务.

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.

这篇关于Nginx 默认公共 www 位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆