如何在云服务器上设置/配置Laravel项目 [英] How to setup/configure laravel project on cloud server
问题描述
我在/var/www/html/application-folder/public_html
当我输入apache server IP
时,它不会加载laravel应用程序,而是显示Apache主页
When I enter the apache server IP
it doesn't load the laravel application instead it displays the Apache home page
如何显示URL /var/www/html/application-folder/public_html
?
当我键入完整的URL时,出现以下错误:
When I type the full url I get the following error:
禁止 您无权访问此服务器上的/folder/public_html/index.php. Apache/2.2.15(CentOS)服务器
Forbidden You don't have permission to access /folder/public_html/index.php on this server. Apache/2.2.15 (CentOS) Server
推荐答案
如果您具有对服务器的完全根访问权限,则可以
If you have full root access to your server then you can
第1步
将您的laravel项目从开发机器(本地)上传到服务器上的/var/www
-上载除vendor
和node_modules
Step 1
upload your laravel project from the development machine(local) to the /var/www
on your server - upload all folders except vendor
and node_modules
第二步
项目上传后,请运行composer install
,如果需要任何节点包,请运行npm install
Step2
once the project is uploaded, run composer install
, if you need any of the node packages run npm install
第3步
使用DocumentRoot /var/www/yourProjectFolder/public
第4步
确保storage
文件夹对您的apache/webserver用户具有写权限-递归
Step 4
Ensure storage
folder has write permissions for your apache/webserver user - recursively
第5步
确保public
文件夹具有适当的权限-递归,如果您以root
的身份上传了项目,则需要更改所有者/权限
Step 5
Ensure that public
folder has appropriate permissions - recursively, if you have uploaded the project as root
then you will need to change the owner/permissions
按照此工作流程,您将能够启动并运行您的Laravel网站.
Following this workflow you will be able to get your Laravel site up and running.
此处要进行的重要区别是,您具有对服务器的完全root访问权限,并且可以在继续工作流之前在服务器上安装composer和/或npm.
Important distinction to make here is that you have full root access to your server and that you can install composer and/or npm on your server before proceeding with the workflow.
如果无法在服务器上安装composer和/或npm,则还必须将vendor
目录上载到服务器(并且如果需要任何节点软件包,则还需要node_modules
)-按照上面我的评论中的文档链接进行操作将对您有所帮助.
If you can't install composer and/or npm on your server, then you have to upload the vendor
directory to your server as well (and if you need any node packages then the node_modules
as well) - following the documentation link in my comment above will help you.
这篇关于如何在云服务器上设置/配置Laravel项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!