Hosting files from a different directory

  • | 159 points

    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 in laragon/www.

    For example, I might have projects in the following locations:

    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?

  • | 16349 points

    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\, with project1, project2 and project3 as subfolders. Set Laragon > menu > preferences > data folder: D:\users\me\www\. Then Laragon will automatically create the host alias project1.test , project2.test and project3.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 see auto.project1.test.conf, copy this file and paste a couple of copies, rename them e.g. manual.project2.test.conf and manual.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: project2.test project3.test

    They will then be available by browsing to project2.test and project3.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.

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.