
幾個小時前我剛玩了 Laravel,但似乎碰壁了。我的 nginx 文檔根目錄是usr/share/nginx/html/
.在這個資料夾中,我有一個index.php
(顯示phpinfo();
)和一個 Laravel 4 專案在該資料夾下helloworld
在Laravelhelloworld
專案中,我有一個像這樣的routes.php
Route::get('/', function()
{
return 'hello world';
});
Route::get('about', function()
{
return 'this is about';
});
導航到localhost/helloworld/public/
並顯示hello world
,這是正確的。但是,導航到 時localhost/helloworld/public/about
,它index.php
在文檔根目錄中顯示html
,而不是顯示this is about
看來我配置錯誤了。這是我的 nginx預設設定檔
請幫忙。先感謝您。
答案1
您還沒有為您的伺服器定義根目錄,請將這一行放入您的設定中:
根 /usr/share/nginx/html/helloworld/public;
您不應更改 default.conf,而應建立專用於您的服務的其他檔案。