title: Laravel: Class "App\Models\Device" not found in web.php (only in production)
body: <p>i'm trying to make an example project to learn laravel. I set up the project on my computer and everything worked fine: I have my <code>web.php</code> that routes <code>/</code> to a view, but before that it collects devices so it can show you some data.</p>
  <p>I decided to try and host it on a Debian AWS instance so I cloned my repo in <code>/var/www/</code>, migrated the database, wrote the <code>.env</code>, <code>composer install</code>, set folder ownership to admin user and permissions to storage and bootstrap.</p>
  <p>Once i configured nginx i tried it by navigating to the url and the answer was <code>Class &quot;App\Models\Device&quot; not found.</code></p>
  <p>I checked the namespaces, file names, I even read that debian is a sucker for caps sensitivity so i double checked every capital letter in every name and since app folder is named app and not App i even tried to import it as <code>app\Models\Device</code> but to no avail.</p>
  <p>I also tried with <code>composer dump-autoload</code> as many on SO suggested, but nothing changed at all.</p>
  <p>Am i missing something?</p>
  <p>Device.php</p>
  <pre><code>&lt;?php
  
  namespace App\Models;
  
  use Illuminate\Database\Eloquent\Factories\HasFactory;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\SoftDeletes;
  
  class Device extends Model
  {
      use HasFactory;
      use SoftDeletes;
  
  
      protected $fillable = [
          'serial',
          'livello_acqua',
          'umidita',
          'temperatura',
          'livello_mangime',
          'stato_rele_1',
          'stato_rele_2',
          'stato_rele_3',
          'stato_rele_4',
          'descrizione',
      ];
  
      public static function findBySerial($serial){
          return Device::where('serial', $serial)-&gt;get();
      }
  
      public static function findByUser($id){
          return Device::where('user_id', $id)-&gt;get();
      }
  
  }
  </code></pre>
  <p>web.php</p>
  <pre><code>&lt;?php
  
  use app\Models\Device; //\app\Models\Device - App\Models\Device - \App\Model\Device
  use Illuminate\Support\Facades\Route;
  /*
  |--------------------------------------------------------------------------
  | Web Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register web routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | contains the &quot;web&quot; middleware group. Now create something great!
  |
  */
  
  Route::get('/', function () {
      $devices = Device::all();
  
      return view('index')-&gt;with(['devices' =&gt; $devices]);
  });
  </code></pre>
  <p>Structure:</p>
  <pre><code>- app
  - - Models
  - - - Device
  - - ...
  - ...
  - routes
  - - web.php
  - ...
  </code></pre>