Laravel은 Nginx의 잘못된 디렉토리로 라우팅됩니다.

Laravel은 Nginx의 잘못된 디렉토리로 라우팅됩니다.

나는 몇 시간 전에 Laravel을 가지고 놀았는데 벽에 부딪힌 것 같았습니다. 내 nginx 문서 루트는 usr/share/nginx/html/. 이 폴더 안에는 index.php(표시 ) 이 있고 phpinfo();해당 폴더 아래에 Laravel 4 프로젝트가 있습니다.helloworld

Laravel helloworld프로젝트에는 다음과 같은 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.phphtmlthis is about

제가 뭔가 잘못 설정한 것 같습니다. 이건 내 nginx야default.conf

도와주세요. 미리 감사드립니다.

답변1

서버의 루트를 정의하지 않았습니다. 구성에 다음 줄을 입력하세요.

루트 /usr/share/nginx/html/helloworld/public;

default.conf를 변경해서는 안 되며 서비스 전용의 다른 파일을 생성해야 합니다.

관련 정보