rohan0793
1 month ago
247
1
Servers

How to host a Laravel application at a route of another Laravel application?

Posted 1 month ago by rohan0793

I have a Laravel application hosted at mydomain.com, and now I have another Laravel application that I would like to host at mydomain.com/email. I went through a guide on https://serversforhackers.com/c/nginx-php-in-subdirectory and it made a lot of sense to me, and worked perfectly.

But the company I work for uses Apache2 on production and I am trying to translate this configuration to apache 2. But I am not sure how.

Here is what I have done so far. I have added Alias /email /dir/of/nested/laravel/app/public to my main laravel application's apache config.

With this the routes on mydomain.com/email no longer show a 404 from Laravel side, but now they are being redirected to the nested application, I know this because going to mydomain.com/email redirects me to mydomain.com/email/login. But now I trying to figure out what do I need to change in the .htaccess of the nested Laravel app to make the work, because I see a 404 from Apache on all routes of /email.

Any ideas anyone? Will it require some kind of a Rewrite rule?

Also how good is this is solution? Will I be restricted to one server because of this? Will it be scalable?

In one of the forums, I saw someone mention that they had a similar architecture, but they used a load balancer to redirect all the nested laravel app routes, is that a better solution than this?

Please sign in or create an account to participate in this conversation.