Laravel is a great framework for PHP. We use it for a broad range of web applications.
Follow our quick guide to get Laravel set up on your AWS Ec2 Linux instance.
Install Laravel
We’re going to use Git and Composer to do the heavy lifting for us.
Git
If you do not have Git installed on your instance, grab this first:
Check if you have it:: $~ git –version
Install Git:
$~ sudo yum install git
$~ sudo yum install git
Composer
If you do not have Composer installed on your instance, grab this first:
Check if you have it:: $~ sudo composer -V
Install Composer:
$~ curl -sS https://getcomposer.org/installer | php
$~ mv composer.phar /usr/bin/composer
$~ chmod +x /usr/bin/composer
laravel
Grab Laravel from Git:
$~ cd /var/www/html
$~ git clone https://github.com/laravel/laravel.git
Install Laravel:
It’s advisable that you do not run composer when using root permissions
$~ cd /var/www/html/laravel
$~ composer install
Set Permissions
$~ sudo chown -R apache.apache /var/www/html/laravel
$~ chmod -R 755 /var/www/html/laravel
$~ chmod -R 755 /var/www/html/laravel/storage
Set Laravel Key
$~ sudo cp .env.example .env
$~ sudo php artisan key:generate
Set Routing / Virtual Host
$~ sudo vim /etc/httpd/conf/httpd.conf
$- i
Paste the following at the end of the file
<VirtualHost *:80>
ServerName laravel.example.com
DocumentRoot /var/www/html/laravel/public
<Directory /var/www/html/laravel>
AllowOverride All
</Directory>
</VirtualHost>
$- esc :wq
$- service httpd restart