Configure /var/www/custom_domain
Directory ownership
sudo chown $USER:www-data /var/www/custom_domain
sudo chmod g+s /var/www/custom_domain
sudo chmod o-rwx /var/www/custom_domain
Apacheconf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/custom_domain.conf
sudo nano /etc/apache2/sites-available/custom_domain.conf
<VirtualHost *:80>
ServerName custom_domain.test
ServerAlias *.custom_domain.test
DocumentRoot /var/www/custom_domain/public
FallbackResource /index.php
<Directory "/var/www/custom_domain/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Activate virtual host
sudo a2ensite custom_domain.conf
sudo service apache2 reload
Switch php
version used by apache
Install different php version
sudo apt install php*.* php*.*-mysql php*.*-mbstring libapache2-mod-php*.*
Enable php version
Disable php version