Home / Laravel / How to install Laravel 5 with Virtual Host configurations

How to install Laravel 5 with Virtual Host configurations

I am sharing steps below with terminal command run screenshots that how to install laravel5 with Virtual Hosts configurations. we need to install composer to download laravel from remote server. for this first command will be for download composer using curl then second one move composer to local user directory for make composer globally use .

# installing composer
curl -sS https://getcomposer.org/installer | php
# move composer globally
sudo mv composer.phar /usr/local/bin/composer
# check composer working


Now we’ve composer installed successfully!!. and then there are two method to install laravel
1. Via Laravel Installer
2. Via composer

1. Via Laravel Installer :

laravel installer is a new method to install added for laravel 5. it’s much faster method than installing via Composer.

# Download installer

Rasel Khan:~$ composer global require "laravel/installer=~1.1"
Changed current directory to /home/khan/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

#Setting up path

Rasel Khan:~$ export PATH="~/.composer/vendor/bin:$PATH"

# If you’ve successfully configure then command type ‘laravel’ , you’ll see your laravel installer version 1.2.1

Rasel Khan:~$ laravel
Laravel Installer version 1.2.1

  command [options] [arguments]

  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help  Displays help for a command
  list  Lists commands
  new   Create a new Laravel application.

#Change dir where to install

Rasel Khan:~$ cd /var/www/project/

# Download and installing

Rasel Khan:~$ laravel new laravel5

# giving permission

Rasel Khan:~$ sudo chmod -R 777 laravel5

2. Via Composer :-

After install composer you can directly install laravel by create-project command and give your destination path where you want to install laravel.

# checking composer is successfully installed

Rasel Khan:~$ composer

# Create a ditectory where to install

Rasel Khan:~$ sudo mkdir /var/www/project/laravel5
[sudo] password for khan: 

# downloading and install via composer

Rasel Khan:~$ sudo composer create-project laravel/laravel /var/www/project/laravel5

# setting up writable permission

Rasel Khan:~$ sudo chmod -R 777 /var/www/project/laravel5

Another way you can do manually download and install

Now, let’s go configure with Virtual Hosts, create a config file into /etc/apache2/sites-available/ directory, i’ve create this file name called laravel5.com.conf, another way you’ll use Vagrant environments

Rasel Khan:~$ sudo mkdir /etc/apache2/sites-available/laravel5.com.conf

# now open laravel5.com.conf file using any editor, I’m using nano editor .

Rasel Khan:~$ sudo nano /etc/apache2/sites-available/laravel5.com.conf

# past below this code into laravel5.com.conf file and save .

<VirtualHost *:80>
    ServerName laravel5.dev
    DocumentRoot "/var/www/project/laravel5/public/"
    DirectoryIndex index.php
    <Directory /var/www/project/laravel5/public/>
        AllowOverride All

# Enable this file

Rasel Khan:~$ sudo a2ensite laravel5.com.conf

# Reload apache server

Rasel Khan:~$ sudo service apache2 reload

# go to hosts file

Rasel Khan:~$ sudo nano /etc/hosts

# create a new one laravel5.dev       localhost       raselkhan       symfony.dev       laravel5.dev

# If you’ve all configuration is ok then need to restart your server

Rasel Khan:~$  sudo service apache2 restart

# now go any browser addressbar url and type


you’ll see laravel5 successfully install and configuration with virtual hosts.


Enjoy 🙂

About Rasel Khan

Check Also

How to fix qualified domain name

When you restart your apache server using the command Someone get the following error: Let’s …


  1. Thanks very interesting blog!

  2. It is best to take part in a contest for among the finest blogs on the web. I will suggest this website!

Leave a Reply

Your email address will not be published. Required fields are marked *