2016-06-23 3 views
0

Laravel 5.1에 웹 사이트를 설정했습니다. 홈페이지를 제외한 모든 페이지에서 404 오류가 발생합니다. 그러나 URL에 index.php를 추가하면 작동합니다. 내 사이트는 웹 서버로 Nginx가있는 우분투 컴퓨터에서 실행됩니다. 잘Laravel 5.1은 홈페이지를 제외하고 404를 찾을 수 없음

로드 : mysite.com/index.php/dashboard

(404) 부여 : mysite.com/dashboard

공용 폴더에 내 htaccess로 :

<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 
    RewriteBase/


    # Redirect Trailing Slashes If Not A Folder... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 
</IfModule> 

시간을 내 주셔서 감사 드리며 모든 도움을 주시면 감사하겠습니다.

편집 :

이 내 Nginx에의 conf입니다 :

서버 { 서버 _ mysite.com; return 301 $ scheme : //www.mysite.com$request_uri; }

서버 { 수신 대기 80; server_name www.mysite.com;

# note that these lines are originally from the "location /" block 
root /usr/share/web/site/public; 
index index.php index.html index.htm; 

    location/{ 
      try_files $uri $uri/ /index.php?$query_string; 
    } 


error_page 404 /404.html; 
error_page 500 502 503 504 /50x.html; 
location = /50x.html { 
    root /usr/share/web/html; 
} 

location ~ \.php$ { 
try_files $uri /index.php =404; 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 

    # fastcgi_pass 127.0.0.1:9000; 
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 

    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

    fastcgi_max_temp_file_size 0; 
    fastcgi_buffer_size 4K; 
    fastcgi_buffers 64 4k; 

    include  fastcgi_params; 
} 

} 

답변

1

.htaccess는 Apache 용입니다. 그것은 Nginx에서 작동하지 않습니다.

귀하의 nginx 사이트 구성이 시도합니다 (Laravel 문서에서 가져옵니다.)

location/{ 
    try_files $uri $uri/ /index.php?$query_string; 
} 
+0

내 파일에있는 것을 가지고있다. 위 참조. –

+0

죄송합니다. 나는 종종 Nginx를 자주 사용하지 않기 때문에 내가 더 너를 도울 수 있다고 생각하지 않는다. – Patrick

관련 문제