Nginx-我真的需要站点可用和站点启用的文件夹吗? [英] Nginx - Do I really need sites-available and sites-enabled folders?
问题描述
我已经在Stack Overflow上搜索了一个直接的答案,但是没有找到它.我注意到我的Nginx安装有三个名为
I have searched Stack Overflow for a straight answer but have not found it. I noticed my install of nginx has three folders called
etc/nginx/sites-available
etc/nginx/sites-enabled
etc/nginx/conf.d
如果我只想直接在etc/nginx/nginx.conf
文件中工作并删除nginx.conf
中包含这些项目的include
行,我真的需要这些吗?如果我删除这些目录,这些目录还会用于其他会弄乱事情的事情吗?
Do I really need these if I just want to work directly in the etc/nginx/nginx.conf
file and remove the include
lines that include these items in nginx.conf
? Are these directories used for anything else that would mess things up if I delete them?
推荐答案
否,如果您在nginx.conf中正确定义了服务器块,则不需要它们,但强烈建议这样做.正如您所注意到的,仅由于nginx.conf中的include /etc/nginx/sites-enabled/*;
而使用它们.
No, they are not needed if you define your server blocks properly in nginx.conf, but it's highly suggested. As you noticed, they are only used because of the include /etc/nginx/sites-enabled/*;
in nginx.conf.
出于好奇,您是否有理由不想使用它们?它们非常有用.更容易添加新站点,禁用站点等.而不是拥有一个大的配置文件.这是nginx文件夹布局的一种最佳实践.
For curiosity, is there a reason why you do not want to use them? They are very useful; easier to add new sites, disabling sites, etc. Rather than having one large config file. This is a kind of a best practice of nginx folder layout.
这篇关于Nginx-我真的需要站点可用和站点启用的文件夹吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!