title: Nginx on Ubuntu Server throws 404 not found
body: <p>After rebooting the laravel-based website on a Ubuntu server using nginx, and configured everything properly (hopefully, at least it worked before), I can only access to the index page but not any other page - nginx keeps throwing 404 not found.</p>
  
  <p>Thought it could be permission issue but I've already tried </p>
  
  <p><code>sudo chown -R :www-data /var/www/foo-bar
  sudo chmod -R 775 /var/www/foo-bar/storage
  sudo chmod -R 775 /var/www/foo-bar/resources</code></p>
  
  <p>But seems not helping. And here is my nginx config file:</p>
  
  <pre><code>server {
      listen 80 default_server;
      listen [::]:80 default_server ipv6only=on;
      root /var/www/foo-bar/public;
      index index.php index.html index.htm;
  
      server_name 120.25.203.113;
  
      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
  
      location ~ \.php$ {
          try_files $uri /index.php =404;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass unix:/var/run/php5-fpm.sock;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
      }
  }
  </code></pre>
  
  <p>Any idea?
  (Try <a href="http://120.25.203.113/" rel="nofollow">http://120.25.203.113/</a> and click on the center button to have a look if interested!)</p>
  
  <h2>Update: the error log shows</h2>
  
  <pre><code>[error] 24119#0: *77 open() "/var/www/ozunimate/public/student/register" failed (2: No such file or directory), client: 14.202.230.9, server: 120.25.203.113, request: "GET /student/register HTTP/1.1", host: "120.25.203.113", referrer: "http://120.25.203.113/"
  </code></pre>
  
  <p>"student/register" is not under /public and should be redirected (it used to be redirected normally before rebooting). Seems redirect not working anymore.</p>