(How) Laravel Deploy with FTP

安稳与你 提交于 2019-12-02 05:19:39

Simply drag and drop the root folder to your server's root. Not to the public_html directory. The only thing that should be in the public_html directory is Laravel's "public" directory (thus you have to rename it, depending on your server's settings).

Do not put your configuration files inside the public_html folder or anyone will be able to access them and steal your data.

Did you make sure that you pointed the web server to the public/ folder? There is an index.php file in that folder that bootstraps the entire site.

Deploying to Shared Hosting:

Zip your project and upload it to public_html and Extract it

Create Database in mysql databases ( in cPanel )

Import .sql file from local phpmyadmin to online hosting

Now go to public_html and edit .env file, change the following

DB_DATABASE=yourdatabasename
DB_USERNAME=database username
DB_PASSWORD=database password

and now just open yourwebsite.com and your app will be there !

Deploying On Cloud Hosting

First of all go to your site or host/phpmyadmin and create new database and upload your sql database file ( which you can import from local phpmyadmin )

Create Drop and upload all files

Click on create new droplet and select LAMP from applications tab , now upload all files to your droplets folder (/var/www/html) through filezilla

Note : Make sure you changed database username , password and name in .env before uploading

Connect to droplet through SSH (Putty) Now connect to droplet through putty and run below commands

chgrp -R www-data /var/www/html

chmod -R 775 /var/www/html/.env

chmod -R 775 /var/www/html/storage

chmod -R 775 /var/www/html/bootstrap

chmod -R 775 /var/www/html/public/uploads

Enable Modules

Run below command to enable mod_rewrite module

sudo a2enmod rewrite

Now open 000-default.conf

sudo nano /etc/apache2/sites-available/000-default.conf

Add below lines below

 AllowOverride all 

Now restart apache2 server

sudo service apache2 restart 

That's it now go to your site.com and app will be dancing there.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!