Featured image of post LAMP Setup (Ubuntu 22.04)

LAMP Setup (Ubuntu 22.04)

How to setup LAMP stack on Ubuntu 22.04

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

sudo a2enmod php*.*

Disable php version

sudo a2dismod php*.*
By MJ Sabit
Built with Hugo
Theme Stack designed by Jimmy