Dendi Handian
Posted on August 17, 2020
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>
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>
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 the00-default.conf
file. It will prevent your vhost configuration to be gone if you accidentally change the apache2 version which will causing your00-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
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.
Posted on August 17, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.