How to deploy laravel site on hosting?

by lindsey.homenick , in category: Third Party Scripts , a month ago

How to deploy laravel site on hosting?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by wilmer.lemke , a month ago


To deploy a Laravel site on hosting, follow these steps:

  1. Copy your Laravel project files to your hosting server. You can use FTP or any file manager tool provided by your hosting provider to upload the files.
  2. If your hosting provider requires a specific folder structure for the Laravel project, make sure to follow the instructions provided by the hosting provider.
  3. Set the correct file permissions for the Laravel files and directories. Typically, the storage and bootstrap/cache directories need to have write permissions for Laravel to run properly. You can set the permissions using the following commands:
chmod -R 775 storage
chmod -R 775 bootstrap/cache

  1. Create a MySQL database on your hosting server and import your local database to the hosting server. Update the .env file in your Laravel project with the database credentials.
  2. Run the following command in the root directory of your Laravel project to generate a new application key:
php artisan key:generate

  1. Update the APP_URL variable in the .env file with your hosting domain or IP address.
  2. Finally, you can access your Laravel site by visiting your hosting domain or IP address in a web browser.

Please note that these are general steps and might need to be adjusted based on the specific requirements of your hosting provider. It's also recommended to refer to the hosting provider's documentation for any specific instructions related to deploying Laravel applications on their platform.