Reputation: 2875
I have created virtual hosts in the following ways:
- cd /etc/apache2/sites-available
- sudo nano laravel.test.conf
laravel.test.conf
as<VirtualHost *:80>
ServerName laravel.test
ServerAlias www.laravel.test
ServerAdmin [email protected]
DocumentRoot /var/www/laravel/public
<Directory /var/www/laravel/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run command: sudo a2ensite laravel.test
Permission provided:
sudo chown -R www-data: /var/www/laravel
sudo chown -R $USER:$USER /var/www/laravel
sudo chmod -R 755 /var/www
etc/hosts
127.0.0.1 laravel.test www.laravel.test
Reloaded apache sudo systemctl reload apache2
Run configtest sudo apachectl configtest
and received Syntax Ok
Restarted apache server sudo systemctl restart apache2
Now, when I hit larave.test
it loads the site successfully, but when ever I tried to hit any other route then it returns 404
error as shown in image.
This app is the freshly installed laravel one with laravel breeze
so I am pretty much confident that there is a valide route. On top of that, if it was laravel, error, it would have been log it on app level and there would be different UI for 404 pages.
I have checked error log on laravel/storage/logs
as well as apache2 logs on var/log/apache2/error.log
but both of these logs file are empty.
Upvotes: 3
Views: 2432
Reputation: 614
Make sure your rewrite
mod is enabled.
or simply run this in terminal
$ sudo a2enmod rewrite
$ sudo systemctl reload apache2
Upvotes: 6