How to create subdomains and domains separate in Laragon?
-
In our project, we have the backend [laravel] hosted on the domain. For example:
api.domain.com
Our frontend Vue app hosted on the root domain: (
domain.com
)How to accomplish this in Laragon?
-
Any update @leokhoa
-
- First, add
api.domain.com
to hosts file - Add
api.domain.com
to the correspond Virtual Host. Remember to remove theauto.
prefix of the file so Laragon will respect your changes. - Reload Apache.
- First, add
-
Actually, I followed this guide https://forum.laragon.org/topic/1148/what-is-the-correct-way-to-set-up-subdomains and did the following thing.
-
Here is the
etc\hosts
file127.0.0.1 domain.test #vue 127.0.0.1 api.domain.test #laragon magic!
-
Renamed the
"domain"
to"api.domain"
inlaragon\www
folder. -
Removed
auto.
prefix and now currently the file looks like thislaragon\etc\apache2\sites-enabled\api.domain.test.conf
It's still not working..
-
-
When accessing the
api.domain.test
, it displaying Laravel UI(Which is okay and expected!) But, when I access thedomain.test
it displays the laragon default view template?I hope you get what i'm saying.
@leokhoa