I built a laravel project and I normally use localhost with the command "php artisan serve" to test my project
But now, I want to host on server. I successfully connected my server with using FileZilla. and I tested I can put a simple abc.html file and can be accessed with ___.com/abc.html
How to deploy my laravel project to my server? Can I just upload the whole laravel project to server then can access without any command? or must need to remote with SSH and install something?
Thanks!
Simply drag and drop the root folder to your server's root. Not to the public_html directory. The only thing that should be in the public_html directory is Laravel's "public" directory (thus you have to rename it, depending on your server's settings).
Do not put your configuration files inside the public_html folder or anyone will be able to access them and steal your data.
Deploying to Shared Hosting:
Zip your project and upload it to
public_html
and Extract itCreate Database in mysql databases ( in cPanel )
Import .sql file from local phpmyadmin to online hosting
Now go to
public_html
and edit.env
file, change the followingand now just open yourwebsite.com and your app will be there !
Deploying On Cloud Hosting
First of all go to your site or host/phpmyadmin and create new database and upload your sql database file ( which you can import from local phpmyadmin )
Create Drop and upload all files
Click on create new droplet and select LAMP from applications tab , now upload all files to your droplets folder
(/var/www/html)
through filezillaNote : Make sure you changed database username , password and name in .env before uploading
Connect to droplet through SSH (Putty) Now connect to droplet through putty and run below commands
Enable Modules
Run below command to enable mod_rewrite module
Now open 000-default.conf
Add below lines below
Now restart apache2 server
That's it now go to your site.com and app will be dancing there.
Did you make sure that you pointed the web server to the
public/
folder? There is anindex.php
file in that folder that bootstraps the entire site.