There are many reasons why your local host is not working.
Following could be one of the reasons:
1.Make sure that in /etc/apache2/sites-available/your-conf.conf file contains these things :
ServerName www.your-url.test
ServerAlias your-url.test
ServerAdmin webmaster@localhost
DocumentRoot /your-path/your-project/public
<Directory /your-path/your-project>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Problem could be with your PHP version. In our machine, there are two php:
1. For CLI(command line interface)
2. For apache server
Your laravel application may require higher or lower version of php in apache server.
For fixing that either update your php version in apache server to your required version or either setup the fpm for your projects. Then your localhost will start working.
There could be an error in your laravel application.
For checking that use command:
sudo tail -f /var/log/apache2/error.log
After hitting this command you'll see the errors that your laravel application is throwing.
But since your laravel application is running fine using serve command, so most likely problem in your case will be because of different PHP versions in CLI and apache server(front-end).
So you should either setup fpm or either upgrade or downgrade the apache server php version.
I had the same problem and i fixed it by setting up the fpm for my projects.
Thanks