(如何)Laravel部署与FTP [英] (How) Laravel Deploy with FTP

查看:202
本文介绍了(如何)Laravel部署与FTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个laravel项目,我通常使用localhost命令php artisan serve来测试我的项目



但现在,我想在服务器上托管。
我使用FileZilla成功连接了我的服务器。
和我测试我可以放一个简单的abc.html文件,可以用___访问。com / abc.html



如何部署我的laravel项目我的服务器?
我可以将整个laravel项目上传到服务器,然后无需任何命令即可访问?
或者必须使用SSH远程安装?



谢谢!

解决方案

部署到共享主机:



压缩您的项目并将其上传到 public_html 并提取它



在mysql数据库(在cPanel中)创建数据库



导入.sql从本地phpmyadmin到在线托管的文件



现在转到 public_html 并编辑 .env 文件,更改以下

  DB_DATABASE = yourdatabasename 
DB_USERNAME =数据库用户名
DB_PASSWORD =数据库密码

现在只需打开yourwebsite.com,您的应用就会在那里! >

部署云主机



首先去你的网站或主机/ phpmyadmin和创建新数据库并上传您的sql数据库文件(您可以从本地phpmyadmin导入)



创建删除并上传所有文件



点击创建新的小滴并从应用程序选项卡中选择LAMP,现在将所有文件上传到您的水滴文件夹(/ var / www / html)通过filezilla



注意:确保您更改了数据库用户名,密码和名称上传之前的.env



通过SSH(Putty)连接到液滴
现在通过putty连接到液滴并运行下面的命令< ch
$ b


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


启用模块



运行以下命令启用mod_rewrite模块

  sudo a2enmod rewrite 

没有w打开000-default.conf

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

添加以下行

  AllowOverride all 

现在重新启动apache2服务器

  sudo service apache2 restart 

到您的site.com,应用程序将在那里跳舞。


I built a laravel project and I normally use localhost with the command "php artisan serve" to test my project

But now, I want to host on server. I successfully connected my server with using FileZilla. and I tested I can put a simple abc.html file and can be accessed with ___.com/abc.html

How to deploy my laravel project to my server? Can I just upload the whole laravel project to server then can access without any command? or must need to remote with SSH and install something?

Thanks!

解决方案

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.

这篇关于(如何)Laravel部署与FTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆