如何从 nginx.conf 文件中的另一个文件读取文本?
How to read text from another file in nginx.conf file?
我有一个 nginx
配置文件。我不想输入很多带有城市列表和禁止访问 GeoIp
的文本,所以我决定将它放在一个单独的文件中。如何从配置文件中的另一个文件中读取。
我想从另一个文件读取并插入的地方(nginx.conf):
http {
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/warn.log warn;
server_tokens off;
upstream thumbor {
server localhost:8888;
}
...
我放在一个单独的文件中并想在配置文件的 http 块中使用的内容:
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $allowed_country {
default no;
AF no;
AG no;
...
}
Nginx 对此配置模式有一个 include
指令。
我有一个 nginx
配置文件。我不想输入很多带有城市列表和禁止访问 GeoIp
的文本,所以我决定将它放在一个单独的文件中。如何从配置文件中的另一个文件中读取。
我想从另一个文件读取并插入的地方(nginx.conf):
http {
access_log /var/log/nginx/access.log combined;
error_log /var/log/nginx/warn.log warn;
server_tokens off;
upstream thumbor {
server localhost:8888;
}
...
我放在一个单独的文件中并想在配置文件的 http 块中使用的内容:
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $allowed_country {
default no;
AF no;
AG no;
...
}
Nginx 对此配置模式有一个 include
指令。