title: Laravel routes causing 404 Error on live server
body: <p>I have a laravel app developed on my localhost and working perfectly. I am trying to deploy it onto an AWS Lightsail instance using nginx on Ubuntu 20.04. I have uploaded my laravel app and changed the nginx root directory to laravelapp/public.</p>
  <p>The main index page (landing page) is working fine but none of my routes are working (i.e. /login, /about etc). When I try to visit any of the routes I get a 404 not found error.</p>
  <p>Here is my nginx/sites_available/default file:</p>
  <pre><code># Default server configuration
  server {
      listen 80 default_server;
      listen [::]:80 default_server;
  
      root /var/www/investa/public;
  
      index index.php index.html index.htm index.nginx-debian.html;
  
      server_name _;
  
      location / {
          # First attempt to serve request as file, then
          # as directory, then fall back to displaying a 404.
          try_files $uri $uri/ =404;
      }
  
      location ~ \.php$ {
          include snippets/fastcgi-php.conf;
  
          fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
      }
  
  }
  </code></pre>
  <p>and this is the view of my route list:</p>
  <p><a href="https://i.stack.imgur.com/154cx.png" rel="nofollow noreferrer">Laravel App Routes</a></p>