How to setup/configure laravel project on cloud server

夙愿已清 提交于 2019-12-23 04:44:21

问题


I have this laravel application on /var/www/html/application-folder/public_html

When I enter the apache server IP it doesn't load the laravel application instead it displays the Apache home page

How can I display the url /var/www/html/application-folder/public_html ?

When I type the full url I get the following error:

Forbidden You don't have permission to access /folder/public_html/index.php on this server. Apache/2.2.15 (CentOS) Server


回答1:


If you have full root access to your server then you can

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

Step2
once the project is uploaded, run composer install, if you need any of the node packages run npm install

Step 3
create virtual host for your site with DocumentRoot /var/www/yourProjectFolder/public

Step 4
Ensure storage folder has write permissions for your apache/webserver user - recursively

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

Following this workflow you will be able to get your Laravel site up and running.

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.

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.

Refer Virtual Host on Cent Os 6



来源:https://stackoverflow.com/questions/41084164/how-to-setup-configure-laravel-project-on-cloud-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!