2017-09-03 189 views
0

我無法讓我的api調用返回ubuntu 16.04上的任何數據。 這裏是我的路線/ api.php方法:Laravel 5 api路由返回404 apache2

Route::get('comments', function() { 
    // If the Content-Type and Accept headers are set to 'application/json', 
    // this will return a JSON structure. This will be cleaned up later. 
    return Comment::all(); 
}); 

這是RouteServiceProvider:

protected function mapApiRoutes() 
    { 
     Route::prefix('api') 
      ->middleware('api') 
      ->namespace($this->namespace) 
      ->group(base_path('routes/api.php')); 
    } 

時,我打本地主機/ API /評論,我得到404

我做確保AllowOverride All在我的site.conf中設置。

我的數據庫中有與使用工匠種子填充數據的意見表

回答

0

原來我有我所有的API的調用正確的設置。我可以告訴,因爲PHP的工匠路線:列表是正確的。我也正確地設置了我的apache2網站。這個問題最終導致我沒有爲我的基礎文件夾設置正確的權限。

使用此命令:須藤搭配chmod 755 -R yourprojectbasefolderlocation