我有一个Web服务器(Debian,Nginx),其中有多个用PHP编写的站点。出于安全原因,我通过在Nginx配置中将open_basedir
指定为fastcgi_param
来限制每个网站location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PHP_VALUE "open_basedir=$document_root";
}
:
upload_tmp_dir
但这会使前端的文件上传变得复杂,因为默认的临时目录(open_basedir
)在fastcgi_param
之外。最佳解决方案是将其添加为另一个fastcgi_param PHP_VALUE "upload_tmp_dir=$document_root/wp-content/tmp";
:
upload_tmp_dir
但这并不起作用,因为似乎必须在php.ini中设置open_basedir
- 这对我的多个网站都不起作用。
如何解决这个问题并仍然维护Template.NAME.helpers({
headers:function(){
// assumption : parsed JSON is in this.json
var json = this.json;
// get all keys from object json
keys = _.keys(json)
// assumption : 'Status', 'TemplateID', '_id' are never a header
// remove keys which shouldn't be treated as header
keys = _.without(keys, 'Status', 'TemplateID', '_id')
return keys;
}
})
?