How to create a Laravel 4.2 project

This guide assumes you have installed a LAMP server. The steps for correct installation of Laravel 4.2 project are:

sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo a2enmod rewrite
sudo php5enmod mcrypt
sudo service apache2 restart

All commands above is executed once and all commands below is executed as many times as you create new projects.

cd /home/{user}/public_html
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
cd /home/{user}/public_html/{directory}
sudo chmod -R o+w app/storage
sudo chmod -R o+w app/storage/logs
sudo nano /etc/apache2/sites-available/app.dev.conf

The content should be like below:

<VirtualHost *:80>
ServerName app.dev
DocumentRoot /home/{user}/public_html/{directory}/public
<Directory /home/{user}/public_html/{directory}/public>
AllowOverride All
Require all granted
ErrorLog /var/log/apache2/app.dev.error.log
CustomLog /var/log/apache2/app.dev.access.log combined
LogLevel warn
</Directory>
</VirtualHost>

sudo a2ensite app.dev
sudo service apache2 reload
sudo nano /etc/hosts

Add this line below after 127.0.0.1 localhost

127.0.0.1 app.dev

Go to your favorite browser and type: app.dev. If you can see the ‘You have arrived’ message, it means you have installed a Laravel 4.2 application successfully.