我試圖在子文件夾中使用NGINX設置BulletPHP。子文件夾中的BulletPHP REST API和NGINX
- BulletPHP是
domain.de/mi/sp/bullet/
- 我的主要腳本在
domain.de/mi/sp/esa2/index.php
- 和REST API應該accessable上
domain.de/mi/sp/esa2/api
當我打電話http://domain.de/mi/sp/esa2/api/我從BulletPHP 「未找到」。但爲什麼?
這是這條道路的NGINX配置:
location ~ ^/mi/sp/esa2/api {
try_files $request_uri $request_uri/ /mi/sp/esa2/index.php$is_args?u=$args;
}
這是在index.php腳本:
<?php
require __DIR__ . '/../bullet/vendor/autoload.php';
$app = new Bullet\App();
// I also tried '/' here...
$app->path('/mi/sp/esa2/api/', function($request) {
return "Hello World!";
});
echo $app->run(new Bullet\Request());
?>
嗯,這只是一個猜測,因爲我不熟悉nginx,但你在PHP和URL中使用尾部'/',而在'location〜^/mi/sp中使用了非尾部斜槓/ esa2/api'(在api後面沒有斜槓'/')。這可能是問題嗎? –