'Can I run laravel (admin dashboard) and vue (front-end) in a single domain

I have done a project which admin dashboard is done by using laravel+vus (vue (v2.6) inside laravel(v8)) and front end is done by independent vue(v3) js(getting data from laravel api).can i run this two projects in a single domain.That is frond is will load www.domain.com and admin dashboard will load www.domain.com/admin..Can I do like this.?Routing is enable in vuejs.



Solution 1:[1]

You can do that, but typically it is easier to host the backend on a subdomain, e.g. you'd host the backend on something like backend.domain.com and the frontend on domain.com and/or www.domain.com. You can configure a setup like this relatively easy with nginx for example, by setting up two location blocks, one pointing to your Laravel installation, the other one to your vue 3 application.

To get back to your question, you can also set it up like you wanted, e.g. in a subfolder instead of via a subdomain. You can also do that via location blocks with nginx, but then you'd have to make sure that the routes from your backend and your frontend never have any overlap, so I wouldn't recommend to go that way.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Moritur