leokhoa / laragon

Laragon is a portable, isolated, fast & powerful universal development environment for PHP, Node.js, Python, Java, Go, Ruby. It is fast, lightweight, easy-to-use and easy-to-extend.
https://laragon.org
4.36k stars 366 forks source link

Multisite #463

Open Mustakim-Lab-dotcom opened 1 year ago

Mustakim-Lab-dotcom commented 1 year ago

How can I create a multisite with Laragon?

Is there any documentation then it would be helpful for me?

Thank you!

Andres-M-Rios commented 1 year ago

Pretty URLs

One of useful features of Laragon is Auto Virutal Hosts

Just put your project (ex. mysite) in the Document Root (C:\laragon\www) and click “Reload“ button, you’ll have this pretty url: http://mysite.test/

You can change the url format the way you want in Menu > Preferences - just update the {name}.test pattern.

With the mysite example above:

{name}.local -> mysite.local {name}.dev.com -> mysite.dev.com

Note

Each project has each own Virtual Host file located in:

For Apache: {LARAGON_ROOT}\etc\apache2\sites-enabled\auto.{project}.test.conf For Nginx: {LARAGON_ROOT}\etc\nginx\sites-enabled\auto.{project}.test.conf

Content of a .conf file is auto generated. If you have a specific project which has modified content, just remove the auto. prefix, Laragon will keep the content of the .conf file intact.

Virtual Host content is configurable, you can change it by modifying the template in:
{LARAGON_ROOT}\usr\tpl\VirtualHost.tpl

Note: The usr folder is where you keep your own configurations, Laragon respects your changes on any files in the folder.

Mustakim-Lab-dotcom commented 1 year ago

@Andres-M-Rios

Thank you so much for your reply. Appreciate your co-operation too. I will definitely give it a try.

Thanks again! 🫡

getda commented 1 year ago

Pretty URLs

One of useful features of Laragon is Auto Virutal Hosts

Just put your project (ex. mysite) in the Document Root (C:\laragon\www) and click “Reload“ button, you’ll have this pretty url: http://mysite.test/

You can change the url format the way you want in Menu > Preferences - just update the {name}.test pattern.

With the mysite example above:

{name}.local -> mysite.local {name}.dev.com -> mysite.dev.com

Note

Each project has each own Virtual Host file located in:

For Apache: {LARAGON_ROOT}\etc\apache2\sites-enabled\auto.{project}.test.conf For Nginx: {LARAGON_ROOT}\etc\nginx\sites-enabled\auto.{project}.test.conf

Content of a .conf file is auto generated. If you have a specific project which has modified content, just remove the auto. prefix, Laragon will keep the content of the .conf file intact.

Virtual Host content is configurable, you can change it by modifying the template in:
{LARAGON_ROOT}\usr\tpl\VirtualHost.tpl

Note: The usr folder is where you keep your own configurations, Laragon respects your changes on any files in the folder.

If multiple sites need to use different versions of PHP, it seems that this operation is not supported.

MusheAbdulHakim commented 1 year ago

@Andres-M-Rios

I'm trying to set up a multi tenancy project. My project is located in laragon/www/mysite, which gives me the beautiful URL mysite.test. All good.

Now I want each tenant to have it's own subdomain, like {tenant-name}.mysite.test, how would I go about doing that? I'm using Apache2 but I'm not sure how to configure my auto.mysite.test.conf file.

If can setup a wildcard subdomain like *.mysite.test, I think it will resolve my problem. Please help if you have any ideas.

drewwalton19216801 commented 1 year ago

I believe if you just name the directory test.project that will give you the desired functionality.

drewwalton19216801 commented 1 year ago

I believe if you just name the directory test.project that will give you the desired functionality.

no that wont work because what if i have dynamic subdomains they all uses the central domain folder i hope this make sense i still have to do it manually i cant get it working i tried 127.0.0.1 *.project.test it dont work i have to specify let say i need in a laravel project as an example im using stancl multi tenancy now i register a tenant and it create it and the subdomain right for example test1.project.test right now it work if i dont use laragon but let say laravel valet it automatically works but if i use laragon i need to manually edit those in host file i know that valet uses dyanmic dns or something but i not sure how to set that up for laragon i can see there is an option dynamic dns in the laragon but the documentation is not there or maybe im missing something i just need someone to help me

Other than the fact that it does in fact work (I tested it) I have no clue what this wall of text is saying. In fact, I think I smell burnt toast.

What is "stancl multi tenancy?" What do you mean by "...I have dynamic subdomain they all uses the central domain folder..."

And if Laravel Valet works, why don't you use that?

gul-ahmad commented 9 months ago

any solution for this?