Abdulelah.k Abdulelah.k - 1 year ago 155
PHP Question

how to depoly/upload laravel project on bluehost

i have laravel project that is ready to deploy,

i need to deploy it on blue host,

i searched so many times about this but could not find clear answer,

so could you please guide me to deploy this laravel project ?


Answer Source

After trying so many methods, I have managed to deploy a Laravel 5.1 application to a shared hosting. Hope this will save you some time. The following steps are tried and tested in 1and1 dedicated hosting server.

You should have SSH access to the server to install composer and some artisan commands.

Installing composer:

Connect to your server via ssh.

1and1 instances have multiple versions of php installed. Laravel needs at least php version 5.5.29. So you can check the available php versions. php5.5 should be good enough for rest of the steps.

$ ls /usr/bin/ | grep php
$ php5.5 -v
PHP 5.5.33 (cgi-fcgi) (built: Mar 8 2016 15:42:28)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

Go to the desired directory (Normally the website’s root directory). Download the composer installer.

$ wget https://getcomposer.org/installer
$ php5.5 installer

Now you can see a file composer.phar downloaded to the current directory. This should be used for all composer activities.

Upload the source code (or clone from repository) to this directory. (Don’t forget to modify your .env file) Edit the artisan file and scripts part of composer.json file to change all references of php to php5.5

Run the below command to perform composer install.

$ php5.5 composer.phar install

Run the below command to perform db migrate.

$ php5.5 artisan migrate

Replace all the lines in the /public/.htaccess with the below:

RewriteBase /public/

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

At this point your laravel application should be up and running on http://yourdomain.com/public. You can modify your website root to point to /public to remove public from the URL.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download