php - How protect .env file laravel -


i move project host can access .env address mysite.com/.env , display file variables , secure data. .env file :

    app_env=local app_debug=true app_key=base64:xxxxxxx app_url=http://localhost  db_connection=mysql db_host=127.0.0.1 db_port=3306 db_database=xx db_username=xx db_password=secret  cache_driver=file session_driver=file queue_driver=sync  redis_host=127.0.0.1 redis_password=null redis_port=6379  mail_driver=smtp mail_host=mailtrap.io mail_port=2525 mail_username=null mail_password=null mail_encryption=null 

how can hidden file ?and logical solution?

note : (i move files public folder in root directory.)

  1. all except public folder move higher level, such folder laravel - http://prntscr.com/bryvu7

  2. change file publi_html/index.php line

    require __dir__.'/../bootstrap/autoload.php';

to

require __dir__.'/../laravel/bootstrap/autoload.php'; 

and line

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

to

$app = require_once __dir__.'/../laravel/bootstrap/app.php'; $app->bind('path.public', function() {     return __dir__; }); 
  1. change file laravel/server.php line

    require_once __dir__.'/public/index.php';

to

require_once __dir__.'/index.php'; 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -