我想将我的应用程序部署在 Cpanel 上的共享托管上,其中主文档根目录有public_html
但是 Laravel 项目public
您必须按照 2 个步骤将应用程序的公共文件夹更改为 public_html,然后您就可以部署它或执行任何您可以执行的操作:)
-
Edit \App\Providers\AppServiceProvider
register() 方法并添加此代码。
// set the public path to this directory
$this->app->bind('path.public', function() {
return base_path().'/public_html';
});
-
Open server.php
你可以看到这段代码
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
只需将其替换为:
if ($uri !== '/' && file_exists(__DIR__.'/public_html'.$uri)) {
return false;
}
require_once __DIR__.'/public_html/index.php';
然后为您的应用程序提供服务php artisan serve
,您还可以将其部署在您的 Cpanel 共享主机上,其中主文档根 public_html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)