下面的块
location / {
if ($http_origin ~* (https?://[^/]*\.example\.com(:[0-9]+)?)) {
add_header 'Access-Control-Allow-Origin' "$http_origin";
}
try_files $uri $uri/ /index.php?$args;
}
Run Code Online (Sandbox Code Playgroud)
… 导致 404,因为上面的代码永远不会到达try_files指令,所以:
这与nginx的IfIsEvil有关吗?
如果是,那么是否有其他方法可以http_origin通过不使用 if 语句来测试?
我已经用 nginx > 1.4 (1.4.6, 1.7, 1.7.8) 试过了。
只有当它的进程没有运行时,我才想在 puppet 中使用 exec
exec { "execute me":
onlyif => "pgrep -fc 'ruby execute.rb'",
command => "execute me",
}
Run Code Online (Sandbox Code Playgroud)
因此,在上述情况下,如果进程 'ruby execute.rb' 已经在运行,则 exec 不应作为
pgrep -fc 'ruby execute.rb' will return 1.
Run Code Online (Sandbox Code Playgroud)
然而
该命令似乎总是在 puppet 中运行。
在我的 linux 机器上,当我执行 pgrep -fc 'ruby execute.rb' 时,我总是得到大于 0 的值。
我的命令有问题吗?