【发布时间】:2019-09-08 02:45:11
【问题描述】:
最初,我的根 /var/www/html 文件夹中有一堆文件夹,这些文件夹受 location 块保护,如下所示:
location ~ /(folder1|folder2|folder3) {
internal;
}
但现在我意识到,如果我将它们完全从我的根文件夹中取出会更有意义。不过,我希望能够通过 PHP 文件发送这些文件,我正在做这样的事情:
$file_path = '/' . $path . '/' . $prefix . '.' . $suffix;
header('X-Accel-Redirect: ' . $file_path);
header("Content-Type: text/plain");
但是,如果我将这些文件夹放在 /var/www/html 之外并将它们放在 /var/www/protected 中,我如何在 PHP 中访问这些文件?
【问题讨论】:
标签: php nginx nginx-config