简体   繁体   English

将我的项目laravel上传到共享主机

[英]upload my project laravel to a shared host

I have a shared hosting service hostinger. 我有一个共享的托管服务托管人。 as I can upload my laravel 5.2 and configure project? 因为我可以上传laravel 5.2并配置项目?

and I tried using: 我尝试使用:

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider {
/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot() {
    //
}

/**
 * Register any application services.
 *
 * @return void
 */
public function register() {

    $this->app->bind('path.public', function () {
        return base_path() . '/public_html';
    });
   }
}

but still nothing. 但还是一无所有。

I guess easiest and better approach in this situation will be creating of a symlink between public_html and public folders. 我想在这种情况下,最简单,更好的方法将创建之间的符号链接public_htmlpublic文件夹。 Example for Ubuntu/Debian: Ubuntu / Debian的示例:

ln -s /path-to-pub/public_html /path-to-pub/public

This solution is better because when you'll decide to move your project to VPN, dedicated server etc., you will not need to remember about any modifications you made and rewrite any code. 此解决方案更好,因为当您决定将项目移至VPN,专用服务器等时,您将无需记住所做的任何修改并重写任何代码。

Put this code: 输入以下代码:

$app->bind('path.public', function () {
    return base_path() . '/public_html';
});

to bootstrap/app.php and You are good to go. bootstrap/app.php ,你很好。 (I assuming that You renamed public directory already.) (我假设您已经重命名了public目录。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM