比如
location /api {
add_header "Access-Control-Allow-Origin" "*";
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
这时,如果访问 api 下的.php ,就没有 add_header 了,只能重新写一个正则匹配,非常不优美。请问有好的解决方案么?
add_header
include
从同一个文件引用