相关疑难解决方法(0)

在 nginx 配置文件中拆分长行

为了不向后端传递垃圾,我对location指令有一个严格的正则表达式。它看起来像这样:

location ^~ "/(some|stuff|more|bar|etc(-testing)?)/[a-zA-Z0-9]+/...(more|restrict).ext {
    # other directives
}
Run Code Online (Sandbox Code Playgroud)

我想在 80 个字符处折叠该行,有没有办法拆分配置?以下结果会导致语法错误,但这是我正在寻找的内容:

location ^~ "/(some|stuff|more|bar|etc(-testing)?)/[a-zA-Z0-9]+/"\
            "...(more|restrict).ext" {
# results in a literal newline (%0A) being accepted
location ^~ "/(some|stuff|more|bar|etc(-testing)?)/[a-zA-Z0-9]+/
...(more|restrict).ext" {
Run Code Online (Sandbox Code Playgroud)

我在文档中找不到提示(http://wiki.nginx.org/ConfigNotation也没有http://wiki.nginx.org/HttpCoreModule#location提到折叠线的任何内容)

configuration nginx

17
推荐指数
1
解决办法
8178
查看次数

标签 统计

configuration ×1

nginx ×1