0
我有这个服务器块中:如何返回文件?
if ($myVar = 1){
return 200 'abc';
}
不是字符串的,我怎么返回一个文件呢?我试过return 200 /home/abc.html
无济于事。
我有这个服务器块中:如何返回文件?
if ($myVar = 1){
return 200 'abc';
}
不是字符串的,我怎么返回一个文件呢?我试过return 200 /home/abc.html
无济于事。
语法是返回代码URL
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
所以你需要使用这样的行:
if ($myVar = 1){
return 200 http://domain.com/abc.html;
}
使用'rewrite'。 –