回答
收藏
分享
举报
nginx location 是否支持在一个单独的文件中配置?
提问于2020-09-16 11:56

浏览 1k

文章标签

比如以下配置

server {
listen 80;
server_name test.123.com;
charset utf-8;

location = /test {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header Content-Type text/plain;
proxy_pass http://test/eng/bid/test;
}
}


==============

需求是想把 location单独在一个文件中配置,在这个server中引用, 应该如何配置server呢?


比如把location相关的配置都写在location.conf文件中,想在这个server中引用location.conf文件中的配置,如何实现呢?



已修改于2023-03-17 18:31



写下您的回答
发表回答
全部回答(1)

按点赞数排序

按时间排序

在server {}中,加入#include xxxx.conf文件即可(支持通配符)。

include语法在此:http://nginx.org/en/docs/ngx_core_module.html#include

赞同

2

回复举报

回答于2020-09-16 14:22



回复陶辉
回复
提问者
Jial
这家伙很懒还未留下介绍~
0
文章
1
问答
0
粉丝
相关问答