在Nginx中有一个包含大量location
指令的虚拟服务器,是否可以将它们分成几个文件?
示例:
onefile.conf
server {
listen 80;
server_name domain.com;
location 1 { ... }
location 2 { ... }
location 3 { ... }
}
更改为:
server.conf中
server {
listen 80;
server_name domain.com;
include server.location1.conf
include server.location2.conf
include server.location3.conf
}
server.location1.conf
server {
listen 80;
server_name domain.com;
location 1 { ... }
}
server.location2.conf
server {
listen 80;
server_name domain.com;
location 2 { ... }
}
server.location3.conf
server {
listen 80;
server_name domain.com;
location 3 { ... }
}