Upload laravel website to server

Upload laravel website to server

If you have a Laravel website/application, and you need to upload it on server, then this documentation for you. I’m Sujon, sharing here how to upload laravel website to server from cpanel.

1st Step: Make ready application in local environment

First of please open this project from your PowerShell/CMD(Command Prompt). Then run this three command one by one.

php artisan config:clear
php artisan cache:clear
php artisan view:clear

If you run this command. then it’s look like this:

2nd Step: Database and User create in cPanel

From your cPanel go to MySQL Databases, then create a database, a user and add this user to the database with all access. Please note the user password.

3rd Step: Edit Laravel website .env File

Go to your Laravel website local files, and open .env file. After open we need to edit three value, DB_DATABASE, DB_USERNAME, DB_PASSWORD. By default it stay on 14,15,16 no line. Then you need to edit those value with cPanel database name, user and password, which you setup in 2nd step.

4th Step: Organizing files with folder and edit index.php, export the database.

In the 4th step, we need to organize the file with deploy rules.

  • At first cut all files, and move it in a new folder, folder name can be website name, or anything else, but not put any space in the folder name. Here we create folder and name it ‘auction’.
  • Go to public folder and Cut all files, then paste it to besides the ‘auction’ folder.
  • Edit the index.php file, and edit directory url, where /../ , you just remove the .. and place your folder name, like here our folder name ‘auction’. So directory url like this /auction/. By default you need edit 19,34,47 no line.
  • Make all files in zip.
  • Export this Laravel website database.

5th Step: Import this database and Upload zip file in the cPanel

This is the final step. In this step you need to upload the zip file in cPanel directory. Then need to import the database in the cPanel database with phpmyadmin.

Now your website is live. Cheers!

Leave a Comment

Your email address will not be published. Required fields are marked *