2013-08-15 18 views
5

Kayıtlı tüm rotalarım çalışıyor. Görünümü görüntülerler, ancak her istekte günlük dosyamda bir NotFoundHttpException görünür.Laravel neden tüm rotalar çalışırken bir NotFoundHttpException günlüğü kaydediyor?

NGINX kullanıyorum. NGINX yapılandırmam olabilir mi?

(görünüm gösterir bile) her isteği üzerine kaydedilir hatası:

log.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in /usr/share/nginx/www/example-staging/releases/20130815024541/vendor/laravel/framework/src/Illuminate/Routing/Router.php:1429 
Stack trace: 
#0 /usr/share/nginx/www/example-staging/releases/20130815024541/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1050): Illuminate\Routing\Router->handleRoutingException(Object(Symfony\Component\Routing\Exception\ResourceNotFoundException)) 
#1 /usr/share/nginx/www/example-staging/releases/20130815024541/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1014): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request)) 
#2 /usr/share/nginx/www/example-staging/releases/20130815024541/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(530): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) 
#3 /usr/share/nginx/www/example-staging/releases/20130815024541/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(506): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request)) 
#4 /usr/share/nginx/www/example-staging/releases/20130815024541/content/index.php(49): Illuminate\Foundation\Application->run() 
#5 {main} 

Nginx Yapılandırma:

# Redirect www. 
server { 
    listen 80; 
    server_name www.example.com; 
    rewrite ^(.*) http://example.com$1 permanent; 
} 

server { 
    listen 80; 
    server_name example.com; 

    access_log /var/log/nginx/example.com/access.log; 
    error_log /var/log/nginx/example.com/error.log; 
    rewrite_log on; 

    root /usr/share/nginx/www/example/current/content; 
    index index.php; 

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

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
    location ~* \.php$ { 
     # Server PHP config. 
     fastcgi_pass     unix:/var/run/php5-fpm.sock; 
     fastcgi_index     index.php; 
     fastcgi_split_path_info   ^(.+\.php)(.*)$; 

     # Typical vars in here, nothing interesting. 
     include       /etc/nginx/fastcgi_params; 
     fastcgi_param     SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    } 

    if (!-d $request_filename) { 
     rewrite ^/(.+)/$ /$1 permanent; 
    } 

    location ~ /\.ht { 
     # (deny .htaccess) 
     deny all; 
    } 
} 
+3

o '/ favicon.ico' olabilir mi? Bazı web tarayıcıları, belirtilmemiş olsa bile bunu ister. Access.logda gösterildiği gibi istenen rota nedir? –

+0

Vay ... sen haklıydın. Favicon'du. Teşekkürler. – Justin

cevap

10

Bu Nginx yapılandırma ile ilgisi yoktu.

Favicon'un yolu yanlıştı. Tüm kaynakların bulunduğunu varsaydım çünkü web denetçisinde her şey durum OK ya da 304 idi. Sanırım denetçi ağ sekmesinde favicon'u göstermiyor.

Rubens MARIUZZO belirtildiği gibi

, access.log sen günlüğü 404'ler/Kaynak günlük dosyalarında hataları olarak Bulunamadı durdurmak laravel isterseniz favori simge sen, bir yan not olarak statü 500.

olduğunu gösterdi global.php dosyanızı aşağıdaki gibi düzenleyebilir.

App::error(function(Exception $exception, $code) 
{ 
    // Don't log 404s 
    if ($exception instanceof Symfony\Component\HttpKernel\Exception\NotFoundHttpException) { 
     return; 
    } 

    Log::error($exception); 
}); 
+1

nginx yapılandırmanızın içinde, 'server' bloğu içinde şunu eklemeyi düşünebilirsiniz: 'location = /favicon.ico {log_not_found off; access_log kapalı; } 've/veya' konum = /robots.txt {access_log kapalı; log_not_found kapalı; } ' – fideloper