How to Deploy Laravel on Hostgator Server
1.Login to the control panel of the hosting server. Then go to the files section then click to the ftp accounts(if already not created or don't know) and then create the ftp account.
2. Then download the filezilla and install it. Then ftp details to login on the server. If some issue than contact to the hostgator live support using chat.
3.The go the root of the folders and completely upload your laravel project.
4. Then go the folder laravel/public and copy its all content to the folder public_html in the root and delete the old one.
5. Also update the file few lines of public_html/index.php with
require __DIR__.'/../laravel_new/bootstrap/autoload.php';
$app = require_once __DIR__.'/../laravel_new/bootstrap/app.php';
6. Then go the laravel/.htaccess file and replace the file with to remove the index.php and public.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
7. Then go the Databases section in the control panel and click on the mysql database and create the new database and new user and also give all privilages to the database user.
8. Then go the laravel/config/database.php and change the database name, user name and password also no need the change the host so keep it as localhost or 127.0.0.1 and also change the same in the .env file .
Please comment if any issue.
thanks :)
ReplyDeleteFor laravel, I would recommend you to move away from shared hosting to an IaaS based hosting. Shared servers have performance and security issues. Infrastructures, like DigitalOcean or Linode, are affordable and provides dedicated servers, which means no security or performance issues for your Laravel website. If you don't know how to setup or manage server on these infrastructures, then you can use Cloudways to launch a managed Laravel server on these infrastructures in just few clicks.
ReplyDelete