如何在cPanel子域上设置laravel项目? [英] How to set up a laravel project on cPanel subdomain?

查看:61
本文介绍了如何在cPanel子域上设置laravel项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是cPanel的新手,想知道哪种是在子域上托管Laravel项目的最佳方法.我已经在根目录的根目录下创建了子域.我的客户在public_html文件夹中还有其他网站,但我不想惹他们.我应该如何进行?另外,如果您能告诉我,从持续集成和版本控制的角度来看,用cpanel管理网站的最佳方法是什么,我将不胜感激.谢谢.

I am new to cPanel and wanted to know which is the best way to host a Laravel project on a subdomain. I created the subdomain already with its root in the home directory. My client has other websites in the public_html folder and I don't want to mess with them. How should I proceed? Also, if you could tell me what is the best way to manage a website in cpanel in terms of continuous integration and version control, I would appreciate it. Thanks.

推荐答案

在域主目录的根目录(从public_html向上的一个目录)中,您需要创建文件夹,例如 laravel_project

In root directory in the domains home directory (one up from the public_html) you need to create folder for example laravel_project

sub_domain_folder 是您的sub_domian的文件夹,对于您的第二个站点,其工作方式类似于public_html.

sub_domain_folder is folder of your sub_domian that works like public_html for your second site.

主机原理图:

- root directory
    - laravel_project
    - ...
    - public_ftp
    - public_html
         -- ... (other sub_domains_folders + files for main site)
         -- sub_domian_folder

(第1步)-将所有laravel应用程序文件和文件夹上载到laravel_project 除外公用文件夹

(Step 1) - upload all of your laravel application files and folders in laravel_project except public folder

(第2步)-只需将您的laravel应用程序 public 文件夹(css-js-.htaccess-index.php-...)中的所有文件复制到sub_domain_folder

(Step 2) - Just copy all files in your laravel application public folder (css - js - .htaccess - index.php - ...) in sub_domain_folder

(第3步)-现在,您需要编辑位于 sub_domain_folder (第2步)中的index.php文件,如下所示:

(Step 3) - Now you need to edit your index.php file that locate in sub_domain_folder (Step 2) as below:

require __DIR__.'/../vendor/autoload.php';

$app = require_once __DIR__.'/../bootstrap/app.php';

更改为:

require __DIR__.'/../../laravel_project/vendor/autoload.php';

$app = require_once __DIR__.'/../../laravel_project/bootstrap/app.php';

这篇关于如何在cPanel子域上设置laravel项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆