Laravel中的VPS页面不起作用

I bought VPS and installed on it Laravel, main page working normal and I getting subtitle "Laravel 5" but when I created test page, in route file:

Route::get('/test', function() {
   return 'test' ;
});

I getting this:

 Not Found
 The requested URL /test was not found on this server.
 Apache/2.4.7 (Ubuntu) Server at plerp.net.pl Port 80`

I chmod storage folder on 777.

`

    ServerName www.plerp.net.pl
    DocumentRoot /var/www/laravel/public

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/laravel>
            AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined

`

I think your web server does not have the rewrite module activated. Try this (beware, Apache only instructions below):

  • sudo a2enmod rewrite (for Debian/Ubuntu family)
  • sudo ln -s /etc/httpd/mods-available/rewrite.load /etc/httpd/mods-enabled/ (for Red Hat / CentOS family)

It might not be installed, in which case you'll need to search for it in the distribution's repositories:

  • sudo apt search apache rewrite for deb-based distros
  • sudo yum search httpd rewrite for rpm-based or sudo dnf search httpd rewrite for Fedora 21+

then install it with

  • sudo apt install <name-of-package> for deb-based
  • sudo yum install <name-of-package> for rpm-based (replace yum with dnf for Fedora 21+)

You might want to double check on file and folder permissions, most probably all you need to do is to chown the respective folder under the web server's user.