So, I'm currently working on an e-commerce web app which is based on Laravel + Vue.js and I've separated the project into 2 folders. One folder called "backend" contains the Laravel files and another called "frontend" contains the Vue.js files. To get the web app running locally, I have to run "php artisan serve" in the "backend" folder and "npm run dev" in the "frontend" folder. My question is, how does it work if I want to deploy these two folders in live server such as Plesk or cPanel?
所以,我目前正在开发一个基于Laravel+Vue.js的电子商务网络应用程序,我已经将该项目分成了2个文件夹。一个名为“Backend”的文件夹包含Laravel文件,另一个名为“Fronend”的文件夹包含Vue.js文件。要让Web应用程序在本地运行,我必须在“Backend”文件夹中运行“php artisan Serve”,在“前端”文件夹中运行“npm run dev”。我的问题是,如果我想在Plesk或cPanel等实时服务器上部署这两个文件夹,该如何工作?
I thought of just uploading those two folders in the live server and expect them to work just like a normal PHP-based project. But I think it doesn't work like that.
我想只需将这两个文件夹上传到实时服务器中,并期望它们能像普通的基于PHP的项目一样工作。但我认为事情并不是这样的。
更多回答
You need to configure the server to serve the files properly too. Or ship your frontend to Netlify/Vercel (example) and your backend to Heroku/Fly/Render. Otherwise, a docker container is still the easiest + most flexible way to go!
您还需要配置服务器以正确提供文件。或者将您的前端发送到Netlify/Vercel(示例),将您的后端发送到Heroku/Fly/Render。否则,码头集装箱仍然是最容易+最灵活的方式!
Alright, I'll try it out. Thanks
好吧,我试试。谢谢
优秀答案推荐
我是一名优秀的程序员,十分优秀!