If you’ve developed a Laravel application locally or on another hosting provider, you can migrate it to your ruachost.com hosting account. This process ensures your project files and configurations are properly set up to run on your new server.
Why Migrate Laravel?
-
Move projects from local development to production.
-
Transfer applications between hosting providers.
-
Maintain consistency across environments.
Steps to Migrate Laravel
-
Upload Laravel Project Files.
-
Use cPanel File Manager or SFTP to upload your Laravel project files to your hosting account.
-
Place them in your home directory (e.g.,
/home/username/project).
-
-
Log in via SSH.
-
Connect to your hosting account using SSH.
-
To enable running Artisan easily, add an alias:
Bash echo 'alias artisan="php /home/username/project/artisan"' >> ~/.bashrc source ~/.bashrc
-
-
Make Public Files Accessible.
-
Copy all files from the Laravel
publicdirectory to yourpublic_htmlfolder:Bash cp -r ~/project/public/* ~/public_html -
Alternatively, copy to a subdirectory (e.g.,
public_html/laravel):Bash cp -r ~/project/public/* ~/public_html/laravelIn this case, your site will be accessible athttp://example.com/laravel.
-
-
Update index.php Paths.
-
Open
public_html/index.phpin a text editor. -
Update the following lines to point to your Laravel project directory:
require __DIR__.'/../project/vendor/autoload.php'; require __DIR__.'/../project/bootstrap/app.php';
-
-
Configure Environment File.
-
Edit
.envin your Laravel project directory. -
Update database, mail, and app settings to match your ruachost.com environment.
-
-
Run Migrations and Seeders.
-
From SSH, run:
artisan migrate artisan db:seed -
This will set up your database schema and seed initial data.
-
-
Verify Installation.
-
In your browser, go to
http://example.com. -
You should see your Laravel application running.
-
Notes
|