如何在共享服务器(GoDaddy)上部署Laravel-Vue项目 [英] How to deploy a Laravel-Vue project on shared server (GoDaddy)
问题描述
这是我第一次开发 Laravel Vue应用
.当我使用 php artisan serve
时,一切正常.但是,当我使用 http://localhost/myProject/public
加载它时,不会加载资产.我的图像位于公用文件夹内的 img
目录中.当我单独使用Laravel时,我使用刀片模板来解决此问题.但是现在我无法使用blade,因为它是 Vue
组件.没有 php artisan serve
的情况下如何运行项目?我的最终目的是将项目部署在godaddy共享服务器中.请帮助我.
This is the first time I am developing a Laravel Vue app
. When I use php artisan serve
, everything works fine. But when I load it with http://localhost/myProject/public
, assets are not loaded. My images are in img
directory inside public folder. I was using blade templating to manage this issue when I use Laravel alone. But now I can't use blade since it is a Vue
component. How can I run the project without php artisan serve
? My Ultimate aim is to deploy the project in godaddy shared server. Please help me.
推荐答案
从本地计算机进行开发时,请使用"php artisan serve"调试应用程序.
Debug your application using 'php artisan serve' while you develop from your local machine.
当您将其发布到Godaddy时,压缩项目文件夹(例如"my_project"),然后将zip文件("my_project.zip")上传到godaddy的"public_html"目录中.
When you publish it into godaddy, compress the project folder (say 'my_project') and upload the zip file ('my_project.zip') to 'public_html' directory in godaddy.
解压缩文件夹.
现在目录结构将为'public_html/my_project ...'
Now the directory structure will be 'public_html/my_project...'
您将在'my_project'中有一个'public'目录.现在创建一个指向公共"目录的子域.
you will have a 'public' directory inside 'my_project'. Now create a subdomain which points to the 'public' directory.
就是这样.现在加载子域.资产和api可以完美运行.
That's it. Now load the subdomain. The assets and api's will work perfectly.
这篇关于如何在共享服务器(GoDaddy)上部署Laravel-Vue项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!