大网数据广告活动
服务器运维问答

Apache config file numbering convention; 000-default etc

· 52CE 我爱测

Is there a widely adopted convention for naming apache configuration files? I'm working on an Ubuntu machine and the example files is named 000-default . I recall at a previous project the sysadmin seemed to have an obscure way o…

问题原文

原帖链接 · dwightgunning · CC BY-SA 3.0

Is there a widely adopted convention for naming apache configuration files?

I'm working on an Ubuntu machine and the example files is named 000-default. I recall at a previous project the sysadmin seemed to have an obscure way of choosing the 3-digit prefix to the file names.

I'm curious how most people do this?

Also, does it actually matter all that much? I guess the files are imported in ascending order.

已采纳解答

原帖链接 · parkamark · CC BY-SA 3.0

The files are indeed imported in lexicographical order. How you achieve this ordering is entirely at your discretion, but the easiest method is by prefixing file names with digits/numbers. I'm not aware of any preferred/standardised style for doing this, and what you have described (3 digit prefixes) is a good a method as any. It's fixed length, which also aids visually on a terminal. If you have less than 1000 conf files, 3 digits would make sense. But if you only have up to 100, maybe 2 digits would be better, up to 10 files, single digit, etc etc.

It is also possible to group Apache conf files into sub-directories. Simply create folders like 0.conf, 1.conf, and then place conf files in those to achieve ordering on a more grouped basis. Directories must be named *.conf to be included. This may be useful if you need to disable an entire group of websites in one go, by simply renaming the directory (mv name.conf name.off) and reloading Apache. All conf files under that directory will now have been removed from the configuration.

Note that it does depend on the application as to whether sub-directories are recursively supported. I tried this trick with dnsmasq recently and it doesn't work. Nginx also doesn't support recursively traversing *.conf directories (tested against version 1.10.2).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。