How to create subdomains and domains separate in Laragon?


  • | 759 points

    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?


  • | 759 points

    Any update @leokhoa


  • administrators
    | 125821 points

    @anburocky3

    1. First, add api.domain.com to hosts file
    2. Add api.domain.com to the correspond Virtual Host. Remember to remove the auto. prefix of the file so Laragon will respect your changes.
    3. Reload Apache.

  • | 759 points

    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.

    1. Here is the etc\hosts file

      127.0.0.1	   domain.test       #vue
      127.0.0.1      api.domain.test   #laragon magic!  
      
    2. Renamed the "domain" to "api.domain" in laragon\www folder.

    3. Removed auto. prefix and now currently the file looks like this laragon\etc\apache2\sites-enabled\api.domain.test.conf

    It's still not working..


  • | 759 points

    When accessing the api.domain.test, it displaying Laravel UI(Which is okay and expected!) But, when I access the domain.test it displays the laragon default view template?

    I hope you get what i'm saying. :) @leokhoa


Log in to reply
 

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