title: Laravel API routes not working in production but work in dev environment
body: <p>My front-end is in Vue 3, and my API is in Laravel. My application works fine in the local system, but only web routes work in the production environment, not API routes, giving a 404 error. SPA and API are in a single project hosted on EC2 using the Nginx web server.</p>
  <p><strong>api.php</strong></p>
  <pre><code>use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Route;
  use App\Http\Controllers\AuthController;
  use App\Http\Controllers\PasswordController;
  
  Route::post('register', [AuthController::class,'register']);
  Route::post('login', [AuthController::class,'login']);
  Route::post('forgot', [PasswordController::class,'forgot']);
  Route::post('reset', [PasswordController::class,'reset']);
  Route::middleware('auth:sanctum')-&gt;group(function (){
  Route::get('user',[AuthController::class,'user']);
  Route::post('logout',[AuthController::class,'logout']);
  });
  </code></pre>
  <p><strong>web.php</strong></p>
  <pre><code>use Illuminate\Support\Facades\Route;
  
  Route::get('/{any?}', function () {
      return view('welcome');
  })-&gt;where('any', '^(?!api\/)[\/\w\.\,-]*');
  </code></pre>
  <p><strong>Nginx config file</strong></p>
  <p><a href="https://i.stack.imgur.com/aTyE9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aTyE9.jpg" alt="nginx config file" /></a></p>