是否可以在NGINX中将服务器配置拆分为小配置?

时间:2015-06-30 14:50:51

标签: nginx

在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 { ... }
}

0 个答案:

没有答案