apache2

Comments I use to run Laravel on Apache...


Make update

sudo apt update


Install Apache

sudo apt install apache2


Make sure your firewall statusu is updated

sudo ufw app list


Allow Apache

sudo ufw allow 'Apache'


Check status again

sudo ufw status


Check if Apache is active

sudo systemctl status apache2


Check your hostname

hostname -I


Make dir for project

sudo mkdir /var/www/laravel


Change owner of the project folder

sudo chown -R $USER:$USER /var/www/laravel


Change permissions of project dir

sudo chmod -R 755 /var/www/laravel


Now is time to configure apaches  block.

We create new file in /etc/apache2/sites-available called laravel.conf

sudo nano /etc/apache2/sites-available/laravel.conf


in this file

laravel.config


<VirtualHost *:80>
   ServerName 192.168.1.167
   ServerAdmin webmaster@thedomain.com
   DocumentRoot /var/www/laravel/public

   <Directory /var/www/laravel>
       AllowOverride All
   </Directory>
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Test for mistakes

sudo apache2ctl configtest


Disable default configuration

sudo a2dissite 000-default.conf


Enable ours site

sudo a2ensite laravel.conf


And restart again

sudo systemctl restart apache2


and finaly cd to folder for ours project

cd /var/www/laravel


and run composer to make this project

composer create-project laravel/laravel .



**