I have created virtual hosts in the following ways:
- Created laravel.test.conf as
- cd /etc/apache2/sites-available
- sudo nano laravel.test.conf
- And then updated
laravel.test.confas
<VirtualHost *:80>
ServerName laravel.test
ServerAlias www.laravel.test
ServerAdmin admin@laravel.test
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.testPermission provided:
sudo chown -R www-data: /var/www/laravel
sudo chown -R $USER:$USER /var/www/laravel
sudo chmod -R 755 /var/www
- Added sitename on
etc/hosts
127.0.0.1 laravel.test www.laravel.test
Reloaded apache
sudo systemctl reload apache2Run configtest
sudo apachectl configtestand receivedSyntax OkRestarted 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.
