DEV Community

Dendi Handian
Dendi Handian

Posted on • Updated on

Adding an Existing Project to Laragon

Laragon is the super light-weight local server solution for your PHP application development. Even though I already recommend you to use Docker-based solution with Laradock, but Laragon still the lightest and simplest solution for you.

My first impression about Laragon at the first use is its lack of documentation for adding an existing project to the ecosystem, and I think they only provide feature to create a new one. I started to like Laragon until I figured out how to add an existing project by myself. And I will show you how.

Prerequisites

Install the Laragon first by downloading the installer from the official download page or the github release page.
Then install it like any free software you had install (you knew it). You can start the laragon server right away and to make sure it works you can open http://localhost at your browser and you should see Laragon getting started page. And then prepare any laravel application somewhere in your machine drive to test the server host later.

Adding an existing laravel project to Laragon

the default Laragon folder should be in C:\laragon and you should find the C:\laragon\etc\apache2\sites-enabled\00-default file located here. Open the file using any text editor and you should see the default vhost config for laragon main page like this:

<VirtualHost _default_:80>
    <Directory "C:/laragon/www/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
Enter fullscreen mode Exit fullscreen mode

Don't change anything to the above code, but instead we will insert the new config for our existing app in the new line. So, let's say I have a laravel project located in C:\Users\dendi\codes\simple-laravel-app. The configuration for the above project will be like this:

<VirtualHost *:80> 
    DocumentRoot "C:\Users\dendi\codes\simple-laravel-app\public"
    ServerName simple-laravel-app.test
    ServerAlias *.simple-laravel-app.test
    <Directory "C:\Users\dendi\codes\simple-laravel-app\public">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
Enter fullscreen mode Exit fullscreen mode

The above way is the quickest for you to get started to add an existing project. However, I recommend you to put the vhost config on another file, let's say to all-my-projects.conf in the same folder beside the 00-default.conf file. It will prevent your vhost configuration to be gone if you accidentally change the apache2 version which will causing your 00-default.conf file to be reset.

And it's recommended to use domain .test or .local instead of .dev or .app which will causing SSL redirection error on the browser.

Then reload your laragon server and add the host to C:\Windows\System32\drivers\etc\hosts file:

127.0.0.1 simple-laravel-app.test
Enter fullscreen mode Exit fullscreen mode

Then you should see your project is up at http://simple-laravel-app.test.


Tell me if this article is so helpful and helped you fix your problem in the comment below. Have fun exploring laragon.

Top comments (5)

Collapse
 
nsubramkavin profile image
nsubramkavin

Thanks. That worked for me

Collapse
 
arerex profile image
Arif Zuhairi

thank you

Collapse
 
dendihandian profile image
Dendi Handian

you are welcome

Collapse
 
ferial71 profile image
ferial71

thank you so much that was very helpful

Collapse
 
dendihandian profile image
Dendi Handian • Edited

Glad to hear that