0

I am pretty new in Laravel and I have the following doubt.

I have to migrate a Laravel 5.4 application that I have developed from my local environment to my remote server.

Can I do it in the following way?

  1. Take the entire directory containing my local application and upload it into the /var/www/html directory of my remote server.

  2. Export my local database and import on my remote database.

  3. Change the content of the .env file.

Now the application should work on my remote server. Is it correct or am I missing something and I have to do something else?

4
  • Give it a try, and you'l find out :) Commented Apr 13, 2017 at 9:46
  • It should work,are you getting any error ? Commented Apr 13, 2017 at 9:48
  • If you're missing anything it's configuring a webserver like e.g. apache Commented Apr 13, 2017 at 10:12
  • your server ..? window or linux .? Commented Apr 13, 2017 at 13:28

2 Answers 2

3

here is the steps

Installation On Shared Hostings

  • Unzip the main zip file and upload your public_html folder ( upload vendor folder as well)

  • Give 777 recursive permission to storage/ and bootstrap/ folder

  • Create database in phpmyadmin and import .sql file

  • Set Database in .env file

  • Move all public folder files to root folder in(public_html or your website folder)
  • open index.php

Replace these lines with

 require __DIR__."/../bootstrap/autoload.php";
 $app = require_once __DIR__."/../bootstrap/app.php";

To

require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';

Add these line for setting public path

$app->bind('path.public', function() { return __DIR__; }); (Add this index.php)

Site is ready

Installation On Linux

  • Unzip the main zip file and upload your html folder (without vendor folder)

  • Give 777 permission to storage/ and bootstrap folder

  • i.e (Linux: chmod -R 777 foldername)

  • Run Linux command (composer install or composer update)
  • Create database in phpmyadmin and import .sql file from DB folder
  • Set Database in .env file
  • create vertual host for removing public folder from url

Done

Sign up to request clarification or add additional context in comments.

1 Comment

Only a doubt...I have to upload it on a VPS. Have I to create a virtual host on my remote server? I am accesing using the IP of my VPS server...so...I think that this vistual host will be inaccessible from the outside. So I can declare a virtual host like (myvirtualhost.dev) on my remote server but then how can I reach this virtual host? From outside I can't contact the inner "myvirtualhost.dev". What can I do?
2

you'll maybe have to update some packages on your remote server so Laravel can work properly. More details here : https://github.com/petehouston/laravel-deploy-on-shared-hosting/blob/master/README.md

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.