The following Apache site config can be used to run a Laravel application via a subdirectory (e.g. yourdomain.com/admin).
Config
<VirtualHost *:80>
# What domain these configs are for
ServerName yourdomain.com
# What directory is served when the root domain is visited (e.g. yourdomain.com)
DocumentRoot /var/www/main/public
# What directory is served when yourdomain.com/admin is visited
Alias /admin "/var/www/admin/public"
# Directory settings for main
<Directory /var/www/main/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Directory settings for admin
<Directory /var/www/admin/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mydomain-error.log
CustomLog ${APACHE_LOG_DIR}/mydomain-access.log combined
</VirtualHost>
Summary of setting up an Apache site config
Place config file in /etc/apache2/sites-available
directory
Enable the config with this command:
> a2ensite yourdomain.conf
Run this command to check for any errors in the configs:
> apache2ctl -t
Restart Apache to make the changes take effect:
> systemctl restart apache2
As an alternative to running multiple Laravel apps on the same server via subdirectories you can use separate domains or subdomains. More details here: Multiple Laravel apps on a single Apache server