Prevent Laravel from showing the directory structure and instead show your application when using Apache.
This is done by creating and assigning a new virtual host, to incorporate the
/public
directory.
Once you have downloaded/composer installed the Laravel project or app into /var/www/html
Navigate to the Apache virtual hosts configuration directory
cd /etc/apache2/sites-available
Create a new Apache virtual hosts file
sudo nano the_project.conf
Add (and edit) in the following and save it
<VirtualHost *:80> ServerName domain.com ServerAdmin webmaster@domain.com DocumentRoot /var/www/html/public <Directory /var/www/html> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Disable the default virtual hosts configuration file for Apache2
sudo a2dissite 000-default.conf
Now enable the one created above with
sudo a2ensite the_project
Enable the Apache rewrite module
sudo a2enmod rewrite
Restart Apache
sudo systemctl restart apache2
When you navigate to the domain or IP address instead of the Laravel files and folders showing it will be the app homepage.