简体   繁体   中英

how to protect the public_html folder on shared server?

I've deployed a laravel app to a shared host. All my files are sitting within the public_html folder, including an .env file which contains my database credentials. According to some articles I've read online, the public_html folder is somehow accessible to malicious users...how is that possible and how can I protect it ?

In project/public/index.php

Look for the following:

require __DIR__.’/../bootstrap/autoload.php’;
$app = require_once __DIR__.’/../bootstrap/app.php’;

And Update them to:

require __DIR__.’/../project/bootstrap/autoload.php’;
$app = require_once __DIR__.’/../project/bootstrap/app.php’;

You Might Face problems running composer unless you are uploading the vendors directory.

Reference: https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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