Photovor
Photovor

Reputation: 403

Multiple Laravel apps under one domain

I'm just getting started with Laravel and have just finished some basic applications. I'm trying to come up with a plan on using Laravel more widespread through our organization. I'm trying to figure out how I can have multiple Laravel installs without having to create a ton of Apache vhosts.

Within our company, we have many departments and each of those departments have a variety of internal and public forms and/or apps. Our website structure is all served by the same instance of Apache on a Linux server and we occasionally use virtual hosts to separate out some specific sections, but not departments (as it would be really overwhelming). Our structure on the webserver looks something like this:

/
/department1/someapp
            /anotherapp
/department2/internalapp
            /anotherform
/department3
...and so on

So people basically access it like: www.company.com/department1/someapp etc...We have about 30 different departments which encompass a site of about 52,000 html and php files in a mix of procedural php, javascript, and plain html.

So the issues that I see with multiple installs would yield something like having to access the apps like this:

www.company.com/department1/app1/public
                            app2/public
www.company.com/department2/app1/public etc...

Obviously vhosts would make this look a lot prettier by just being able to access the apps with department1.company.com or department2.company.com, but we don't want to create that many subdomains. So I'm looking for some better ideas on how to do this.

Upvotes: 0

Views: 1988

Answers (2)

Valentine Shi
Valentine Shi

Reputation: 7800

I believe the Linux symlinks could solve your task. They are cheap an clean way to forward your front end requests to the Linux server folders.

You would want to install as many Laravel (or any other software) instances as needed one per the web service you provide to your departments.

You could have the single good looking entry point, say, www.mycompany.com referring to the single vhost entry referring to say /sites folder on your server.

Then, as soon as you have your Accounting Department Laravel webapp (or site) under /accounting folder on the server to access the site with www.mycompany.com/accounting address, you have to create the accounting symlink in /sites folder and this symlink should point at /accounting/public folder of yor Laravel app.

Thus you create as many apps as you need and forward requests to them via the respective symlinks in /sites folder.

Upvotes: 1

Martin Bean
Martin Bean

Reputation: 39389

The entry point for a Laravel app is its index.php file (https://github.com/laravel/laravel/blob/master/public/index.php). So as long as you have a .htaccess file passing all requests through this front controller, you can then change the autoload and bootstrap paths to your heart’s content.

Upvotes: 0

Related Questions