Skip to content

Commit c6337d6

Browse files
committed
add notes for nginx
1 parent d7d7743 commit c6337d6

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

  • projects/LinuxSystemOps/SoftwareManagement/nginx

projects/LinuxSystemOps/SoftwareManagement/nginx/note.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,46 @@ Features:
1515
- Structure view
1616

1717
[github](https://github.com/meanmail-dev/nginx-intellij-plugin)
18+
19+
## nginx docs
20+
21+
You should look at the following URL's in order to grasp a solid understanding of Nginx configuration files in order to
22+
fully unleash the power of Nginx.
23+
24+
- https://www.nginx.com/resources/wiki/start/
25+
- https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
26+
- https://wiki.debian.org/Nginx/DirectoryStructure
27+
28+
## nginx acl
29+
30+
- 使用 allow 和 deny 指令(directives)
31+
- 使用 .htaccess 文件
32+
33+
## Nginx 配置规范
34+
35+
> 推荐使用Git管理配置
36+
37+
### 文件结构 | 目录结构
38+
39+
1. nginx
40+
文件结构,建议遵循Linux发行版本文件结构布局,至少参照 [Filesystem Hierarchy Standard (FHS)](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard)
41+
42+
### 命名规范
43+
44+
1. ssl 证书 命名采用域名fqdn的方式命名,如`ssl/example.com.pem`
45+
46+
### 其他杂项规范
47+
48+
- 通常来说,尽量不要直接修改`nginx.conf`, 使用 `include` 指令配置
49+
50+
- 修改以“最小化原则”方式进行,采用“靠近配置”,如`location > server > http`,优先选择在`location``server`配置,而不是配置在`http`段。
51+
52+
- 应该有适当的注释
53+
54+
- 每个业务使用独立的配置文件,公共部分或者相同部分的配置可以引用(`include`)配置文件,使用业务名或者域名命名文件或目录
55+
56+
- 至少要做到每一个虚拟主机都要有自己独立的日志配置,包括访问日志和错误日志
57+
58+
- 关于include等指令后的路径问题,建议使用绝对路径代替相对路径,除非清楚相对路径的位置
59+
60+
-`nginx -s reload`前,建议使用 `nginx -t -c nginx.conf` 进行语法检查

0 commit comments

Comments
 (0)