Hosting files from a different directory
-
I've just moved over from antiquated XAMPP looking for an easier solution to locally hosting my web projects.
I have Laragon up and running installed on my
C:
drive, but all my projects are in different directories and not inlaragon/www
.For example, I might have projects in the following locations:
C:/laragon/www/project1/index.html
D:/users/me/project2/index.html
D:/users/me/documents/project3/index.html
What I would like to do is to be able to navigate to
localhost
in my browser and see a list of all these projects. I know this is possible with XAMPP but over complicated. How would I go about this with Laragon?
-
Welcome to Laragon! I "found" Laragon over a year ago after trying XAMPP and WAMP and have never looked back.
Laragon "magic" best happens, automatically, from a common root folder. Using your example, if you have all your projects in
D:\users\me\www\
, withproject1
,project2
andproject3
as subfolders. Set Laragon > menu > preferences > data folder:D:\users\me\www\
. Then Laragon will automatically create the host aliasproject1.test
,project2.test
andproject3.test
, and add them to the host file. To navigate to the project open Laragon and start all, then from Laragon menu > www > choose the project to open in your browser.If you want to keep your projects in their current folders, then explore
C:\laragon\etc\apache2\sites-enabled\
, you should already seeauto.project1.test.conf
, copy this file and paste a couple of copies, rename them e.g.manual.project2.test.conf
andmanual.project3.test.conf
, edit them and change them for each proejct e.g.<VirtualHost *:80>
DocumentRoot "D:/users/me/project2/"
ServerName project2.test
ServerAlias *.project2.test
<Directory "D:/users/me/project2/">
....
Next, You will need to edit your
hosts
file, (Laragon > H) and manually add the projects:
127.0.0.1 project2.test
127.0.0.1 project3.test
They will then be available by browsing to
project2.test
andproject3.test
in your browser.If you want to navigate to the projects from localhost: edit
C:\laragon\www\index.php
and add a link to each project, maybe create a list.I hope this helps.