Uploading laravel project in cpanel - laravel

I am trying to upload my Laravel project onto my web server but not work correctly.
my structure is
public_html/shanto_test/
app
bootstrap
public
vendor
artisan
composer.json
server.php
when I type in browser www.myweb.com/shanto_test
then nothing show.

in that case you'd rather have to type in www.myweb.com/shanto_test/public. since the public folder would be the "document root" of your application.
reference
http://laravelbook.com/laravel-architecture/

You can upload laravel project in cpanel following the steps below:
In the public_html/ folder upload the contents of the public
directory of your laravel project.
In the same dierctory level of public_html upload the all contents
except that of public folder.
Your folder structure on cpanel will look like this:
public_html/
css/
fonts/
js/
...
index.php
app/
bootstrap/
database/
...
routes/
.env
Keeping this structure of folders and sub-folders in your cpanel will get your laravel project running successfully.
There are also alternative ways which involves changing folder paths but this felt the most easiest way to me.

Related

Laravel 9 error "Vite manifest not found" on production server

I am deploying Laravel 9 project to shared hosting (without the ability to ssh into the server so I can't npm run build in the server) and I am getting this error:
Vite manifest not found at: laravel_project/public/build/manifest.json
I am using FileZilla to upload the project to the CPanel, I uploaded the public folder into public_html and configured the index.php file.
Before uploading the project i run npm run build locally on my localhost and everything works ok there.
Does anyone have a solution for this ?
I tried changing the APP_ENV=production but it didn't work.
so I found a solution for that which is:
put all my local laravel files and folders including the public folder (of course after running composer install and npm run build locally) inside the public_html directory in the server
now inside the server in public_html directory move the two files .htaccess and index.php of the public folder one level up in way so that the index.php file and the .htaccess file are directly inside the public_html directory (this way you don't have to include /public in your url but instead access the application directly when you visit your website)
configure the content of index.php you just moved from public up to public_html in a way that its links point correctly to the content of the app inside public_html
for example:
__DIR__.'/../storage/framework/maintenance.php'
becomes
__DIR__.'/storage/framework/maintenance.php'
so that the /.. is removed
and the other links too like:
__DIR__.'/../vendor/autoload.php'
becomes
__DIR__.'/vendor/autoload.php'
and
__DIR__.'/../bootstrap/app.php'
becomes
__DIR__.'/bootstrap/app.php'

How to deploy laravel vue site to shared hosting

Deploy laravel vue app in shared hosting
I coppied index.js from public folder to root and changed autoload and bootstrap path.
public folder contains-
dist/css/app.css
dist/js/app.js
mix-manifest.json
mix-manifest.json
{
"/dist/js/app.js": "/dist/js/app.js",
"/dist/css/app.css": "/dist/css/app.css"
}
when i browse,
http://domain_name/dist/css/app.css not found error
I deleted public folder and coppied everything to root.
But i m getting The Mix manifest does not exist error
Is there a way to overcome this.?
Deploying laravel vue app is a headache?
Can i use RewriteBase in htaccess to resolve issue
I can deploy laravel to shared hosting. but using vue in frontend seems not working as expected. I used vue-routes in frontend for routing rather than laravel routes
I'm not an expert but I'm doing it this way
npm run prod to compile assets for production
create a folder in the root directory in the shared host and copy all project files to it
move project's public folder contents to public_html folder
Edit index.php file and change autoload and bootstrap paths to point project folder
Create a symlink to the image folder
ex
symlink('home/username/project_name/public/img','home/username/public_html/img');
create a database and username in CPanel and add to .env file
import data to database.

How to deploy Laravel 5.5 on shared hosting without composer

I am trying to deploy a Laravel project on shared hosting. I copied the Laravel folder in user's root directory (/home/shrpr) and copied the content of public directory in /home/shrpr/www folder. I modified the index.php in public folder to include "../Laravel" as explained in site. Since, composer is not allowed on this shared hosting, I also copied my local vendor and storage folder along with laravel folder. But I still keep on getting error 500. So, I added a test.php file in the laravel folder and included it in index.php file to test if path and all is correct as under:
require __DIR__.'/../laravel/test.php'; die;
This works fine as the content of test.php is getting displayed properly. So, it looks like some dependencies of vendor folder is missing. Is there a way of identifying and uploading complete dependencies of laravel and uploading it, that is without use of composer?
Try composer update before upload to shared hosting.
Change permissons of your index.php to 644.
Check your enviroment, maybe isn't works.
Wich version of php is running in your shared hosting? and wich is yor Laravel version, change php version to 7.0
Make sure you have PHP 5.5+ installed on the server. Move the index.php file from public to www and change the paths accordingly.
Another way to deploy laravel on shared hosting is to set up your domain as addon domain and then set root folder of the addon domain to the /public folder of the laravel project. eg. home/mili/laravelproject/public
I tried this with godaddy and it worked.

How to upload laravel 5.0 project on server

I need to upload laravel 5.0 project on server, my problem is how to upload without composer on server and run properly project.
Put the content of your public folder (Laravel public folder) in public_html.
Then any other files and folders upload them in your root directory:
So your folder structure will look something like this:
Remote server:
--App
bootstrap
Vendors
artisan
etc...
--public_html
|
|
--css
img
index.php
.htaccess
etc...
On localhost without composer:
Your Laravel project folder should be in www folder (if wampp server) or htdocs (xampp) and with this localhost/laravelProject/public your project should work.
You can copy all file form public to root folder or use a htacess file to point main doain to public folder.
Check this article it might help.

Laravel 4 redirect (homepage)

I have finished my website with laravel 4. I deploy it to my server and find out that I need to go to : www.example.com/public/ to access the homepage.
How to do the setup to access the home page directly when typing the url : www.example.com? I did a index.php with a header Location etc etc but Laravel didnt like it^^
Thx
You have to change your virtual host to point to /public rather than the root of the Laravel (/) installation
You can usually do this if you have access to your web host's control panel.
actually, it's better practice and laravel intends to, if you change your directory structure.
let's say, your current dir structure is like this
./
www/
app/
public/
bootstrap/
vendor/
change it :
./
app/
www/
bootstrap/
vendor/
see? move up app, bootstrap, vendor etc. then rename public folder to (in this case:) www or whatever directory used by server doc root.
Or, if you really don't want change directory structure, you can simply use this:
return Redirect::to('/public');

Resources