Run Laravel app from another laravel app on normal hosting (not vpn)
Hi. So i had portfolio app build with laravel. Then i want to users can demo my another laravel app (like my blog, vocuher-validator, etc) on normal hosting. I not prefer VPS cause im broke. Can i do that?
I need this cause i had to improve my CV. 😁
👋
How is your application installed in your hosting?
Where is the root of your application and the public folder?
Maybe you could manage this with subdomains for each application.
In the root of your hosting you will have a folder for each application that contains the whole application apart the content of public folder.
Then, in the public folder (or public_html) of your hosting, you do the same thing: one "public" folder per application with the public content.
Then you just have to set the paths in the index.php file and bind the public folder in the AppServiceProviver.php
You can then assign each public folder to a particular subdomain.
So, for each application, look of the index.php in public folder :
/* Edit with the path of your application root folder */
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
/* Edit with the path of your application root folder */
require __DIR__.'/../vendor/autoload.php';
/* Edit with the path of your application root folder */
$app = require_once __DIR__.'/../bootstrap/app.php';
After that, you can bind the public path of the application in AppServiceProvider.php :
public function register() {
$this->app->bind( 'path.public', function () {
return base_path( '../yourPublicFolder' );
} );
}
@Vable i understand.. But 1 more to be clear. Its only public folder of sub apps?. Not entire?. Then how im seperate which database every sub apps if its only public folder of sub app? 🤔
@husencoolwolf Each Laravel installation must have its own folder. You have to imagine each Laravel application as independent. Even your portfolio.
So in your root folder: one folder per application.
In the public folder of the server: one folder per application. You can then map a subdomain on each public folder.