Laravel contains a lot of files and folders, especially in
/vendor
directory. If we would attempt to upload every file manually either over FTP either over our built-in File Manager it would take a lifetime.
Having that said, the best way to quickly upload your Laravel project to Hostinger is to: archive it, upload the archived content, extract it, and then apply whatever changes are necessary.
1. Compress all files and folder on your main project folder except node_modules folder.
*Important: If you're using Linux distro make sure .env file and other dots files are visible.
2. Go to File manager and upload the compressed project.
*important: Upload outside public_html folder
3. After the file has been uploaded, click on the file and hit ‘Extract’
4. We can make a custom folder name to our extracted folder
5. After finish extracting project file, go to our extracted directory > public. Move all file and folder inside public folder into public_html
6. Edit index.php to configure the file.
Change
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
Into
require __DIR__.'/../{extracted_directory}/vendor/autoload.php';
$app = require_once __DIR__.'/../{extracted_directory}/bootstrap/app.php';
7. That’s it! You have successfully deployed your Laravel project into Hostinger.
If you want to know How to Deploy Laravel Database into Hostinger (Shared Hosting), you can check my other post.
keywords: Laravel, Deploy Laravel, Deploy Laravel to hosting, Hostinger, Laravel on Hostinger
http://zsn-paper.blogspot.com
500 Internal Server Error has occurred
ReplyDeleteSame error? Did you solved it?
DeleteMake sure u're correct on step number 6
DeleteHow can we link storage path in this method.
ReplyDeleteThe simple way is you can make route like this, than access in other tab
DeleteRoute::get('/symlink', function () {
Artisan::call('storage:link');
});
The function will run the storage:link command
OR
You can create a new file in public_html and save it to symlink.php
Than access in other tab, this command will run the symlink method
You can choose the easiest way of you from the 2 methods above
Sorry, my second script is not showing, here the second script is
Deletehttps://pastebin.com/raw/iTVpFdMh
Thank you for shariing this
ReplyDelete