不同位置的nginx配置文件
我正在努力弄清楚位于不同目录中的每个 nginx 配置文件的含义。到目前为止,我已经找到了这些相关的目录/文件:
- /etc/nginx/nginx.conf - 这是 nginx 将读取的主文件。它还具有多个
include
指令来引用其他几个文件中定义的配置。 - /etc/nginx/conf.d/*.conf - 在我的默认安装中,此位置有一个 default.conf 文件。如果我想添加我自己的网站,这是我应该去编辑的吗?
- /etc/nginx/sites-available - 有时这里有一个名为“default”的文件。这个目录是做什么用的,这个配置文件是什么?它和conf.d下的default.conf文件有什么关系?
- /etc/nginx/sites-enabled - 另一个混乱。那么这个目录是什么呢?在我的安装中,我看到一个符号链接文件指向站点可用目录中的“默认”文件。这样做有什么意义,分成两个目录但通过某种方式链接它们?
I'm struggling to figure out the meaning of each nginx configuration file located in different directories. So far I've found these directories/files related:
- /etc/nginx/nginx.conf - this is the main file that nginx will read. It also has several
include
directives to reference configurations defined in several other files. - /etc/nginx/conf.d/*.conf - in my default installation, there's one default.conf file at this location. Is this the one that I should go to edit if I want to, for example, add my own website?
- /etc/nginx/sites-available - Sometimes there's a file named 'default' here. What is this directory for and what's this configuration file? What's its relationship with the default.conf file under conf.d?
- /etc/nginx/sites-enabled - Another confusion. What's this directory then? And on my installation I see a symbolic link file pointing to the 'default' file in the sites-available directory. What's the point of doing this, separating into 2 directories but link them by some means?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论