<i id='J41Gp'><tr id='J41Gp'><dt id='J41Gp'><q id='J41Gp'><span id='J41Gp'><b id='J41Gp'><form id='J41Gp'><ins id='J41Gp'></ins><ul id='J41Gp'></ul><sub id='J41Gp'></sub></form><legend id='J41Gp'></legend><bdo id='J41Gp'><pre id='J41Gp'><center id='J41Gp'></center></pre></bdo></b><th id='J41Gp'></th></span></q></dt></tr></i><div id='J41Gp'><tfoot id='J41Gp'></tfoot><dl id='J41Gp'><fieldset id='J41Gp'></fieldset></dl></div>
      • <bdo id='J41Gp'></bdo><ul id='J41Gp'></ul>

      <small id='J41Gp'></small><noframes id='J41Gp'>

      1. <tfoot id='J41Gp'></tfoot>
        <legend id='J41Gp'><style id='J41Gp'><dir id='J41Gp'><q id='J41Gp'></q></dir></style></legend>
      2. (如何)使用 FTP 部署 Laravel

        时间:2023-10-30

          <i id='7xDhR'><tr id='7xDhR'><dt id='7xDhR'><q id='7xDhR'><span id='7xDhR'><b id='7xDhR'><form id='7xDhR'><ins id='7xDhR'></ins><ul id='7xDhR'></ul><sub id='7xDhR'></sub></form><legend id='7xDhR'></legend><bdo id='7xDhR'><pre id='7xDhR'><center id='7xDhR'></center></pre></bdo></b><th id='7xDhR'></th></span></q></dt></tr></i><div id='7xDhR'><tfoot id='7xDhR'></tfoot><dl id='7xDhR'><fieldset id='7xDhR'></fieldset></dl></div>

          <tfoot id='7xDhR'></tfoot>

            <small id='7xDhR'></small><noframes id='7xDhR'>

                <tbody id='7xDhR'></tbody>
              <legend id='7xDhR'><style id='7xDhR'><dir id='7xDhR'><q id='7xDhR'></q></dir></style></legend>
                  <bdo id='7xDhR'></bdo><ul id='7xDhR'></ul>
                • 本文介绍了(如何)使用 FTP 部署 Laravel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

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

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

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

                  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

                  如何将我的 laravel 项目部署到我的服务器上?我可以将整个 laravel 项目上传到服务器然后无需任何命令即可访问吗?还是必须通过 SSH 远程安装一些东西?

                  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?

                  谢谢!

                  推荐答案

                  部署到共享主机:

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

                  Zip your project and upload it to public_html and Extract it

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

                  Create Database in mysql databases ( in cPanel )

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

                  Import .sql file from local phpmyadmin to online hosting

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

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

                  DB_DATABASE=yourdatabasename
                  DB_USERNAME=database username
                  DB_PASSWORD=database password
                  

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

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

                  在云主机上部署

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

                  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 )

                  创建 Drop 并上传所有文件

                  点击create new droplet并从应用程序选项卡中选择LAMP,现在通过filezilla将所有文件上传到您的droplets文件夹(/var/www/html)

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

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

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

                  通过 SSH (Putty) 连接到 droplet现在通过 putty 连接到 droplet 并运行以下命令

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

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

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

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

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

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

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

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

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

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

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

                  启用模块

                  运行以下命令以启用 mod_rewrite 模块

                  Run below command to enable mod_rewrite module

                  sudo a2enmod rewrite
                  

                  现在打开 000-default.conf

                  Now open 000-default.conf

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

                  在下面添加以下行

                   AllowOverride all 
                  

                  现在重启apache2服务器

                  Now restart apache2 server

                  sudo service apache2 restart 
                  

                  就是这样,现在转到您的 site.com,应用程序将在那里跳舞.

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

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

                  上一篇:Laravel 7:安装 od FTP 服务器 下一篇:在 PHP 中的任意位置插入数组中的新项目

                  相关文章

                  <i id='9vPqB'><tr id='9vPqB'><dt id='9vPqB'><q id='9vPqB'><span id='9vPqB'><b id='9vPqB'><form id='9vPqB'><ins id='9vPqB'></ins><ul id='9vPqB'></ul><sub id='9vPqB'></sub></form><legend id='9vPqB'></legend><bdo id='9vPqB'><pre id='9vPqB'><center id='9vPqB'></center></pre></bdo></b><th id='9vPqB'></th></span></q></dt></tr></i><div id='9vPqB'><tfoot id='9vPqB'></tfoot><dl id='9vPqB'><fieldset id='9vPqB'></fieldset></dl></div>

                    <small id='9vPqB'></small><noframes id='9vPqB'>

                    1. <tfoot id='9vPqB'></tfoot>
                      <legend id='9vPqB'><style id='9vPqB'><dir id='9vPqB'><q id='9vPqB'></q></dir></style></legend>

                        <bdo id='9vPqB'></bdo><ul id='9vPqB'></ul>