multiple Laravel projects and virtual hosts setup in local environment


I'm currently studying this amazing PHP framework called Laravel. My goal is to build 5 web sites/applications using Laravel this year.

I've been doing tons of readings on the web related to Laravel from installation/setup to the actual development codes.
I will be sharing some of the things that I've learned in this Laravel journey that maybe worthy of posting.

The first thing that I had to figure out was how to setup multiple Laravel projects in my local laptop then access those sites locally. It turns out that there's easy way to accomplish this.

Environment Tested
* Windows 7 64bit
* Apache HTTP server version 2.2
* PHP version 5.3.20
* Laravel version 3.2

I'm not going to cover how to install Apache HTTP server and PHP in your local machine, which maybe Windows, Mac, or even Linux. There are plenty of documentations on how to install and they now even have drop in packages that are all self-contained and configured for Windows.

Let's assume that I want to build two websites called and (p.s. these two domains are already owned by someone else).

In order to create these two websites using Laravel, I would need to be able to do development work and test them out in my local machine before uploading the source files to the LIVE server, right?

I'm sure there are different ways of configure this in your local machine but I find the below example as the easiest way to support multiple Laravel projects for me.

Step 0: download Laravel framework
First thing first, go to the Laravel website then download the latest version 3 then extract the Laravel zip file to a temporary location.

Step 1: create project folders
Create two folders under [Apache install dir]/htdocs folder then rename the folders to reflect your project/website. For this example, I have created "justdoit" and "mango" folders inside the htdocs folder.

Step 2: copy Laravel framework to project folders
Copy the entire Laravel folders and files inside each project folder. Make sure you can find "public" folder and "paths.php" file in your root project folder. If you don't, then you did not copy the Laravel framework files correctly.

Step 3: create virtual hosts for local computer
Open the "hosts" file (located under [Windows]/System32/drivers/etc/ folder in Windows7 64bit) then add the entries for virtual hosts with ip address, which is a special ip address for the local machine/host. You can call the virtual host name whatever you want but I called mine "" and ""

Step 4: add the virtual host mapping to project folder
Open the "httpd-vhosts.conf" file (located under [Apache install folder]/conf/extra/ folder) and add the VirtualHost entries as shown below. The DocumentRoot should be mapped to the "public" folder in your project folder and the ServerName should match the virtual host created in Step 3 above.

Step 5: restart the Apache server

Step 6: Update the index view file
In each project folder, open the [project]/application/views/home/index.blade.php file then add the project name anywhere so that we can easily confirm with project website app we are working with.

Step 7: test the each project web app locally
Open any browser then type the virtual host urls:

Done! Your are now ready to develop two websites using Laravel framework!
Make sure to refer to the Laravel documentations on additional important configuration changes, such as the ApplicationKey and database settings.

Happy Coding! enjoy.
Go Back to List Page

Leave a comment

Name : Comment : view emoticons
Please consider signing up for our website.
If you sign up and log in:
  •   You can avoid the "I'm not a robot" captcha when commenting
  •   You can also avoid typing your name every time
  •   You can upload a picture for each comment
  •   You can change or delete your comment within 1 hour
  •   You can track all the comments you posted on this site
  •   You can read blog posts that are only open to members
  •   You can look up blogs using the search feature
  •   More privileges for our friends & families coming...

OK, Sign me up!

Emoticons are a great way to visually express how you feel.
However, there are times when unintended content is converted to emoticon because the content happens to have one of the emoticon symbols. That's why it's always good idea to preview your comment before posting and when you see this type of problem, you can indicate NOT to auto convert.