.ENV file is visible

前端 未结 4 1389
再見小時候
再見小時候 2021-02-19 03:45

I am using Laravel 5.1

I recently uploaded my project in shared hosting. but when i browse http://siteAddress.com/local/.env my .env file is visible.

<
4条回答
  •  盖世英雄少女心
    2021-02-19 04:22

    The .env file resides outside the public folder so it should not be visible from outside world if the server is configured to see the public folder as document root.

    From the best answer:

    Remember that once your server is configured to see the public folder as the document root, no one can view the files that one level down that folder, which means that your .env file is already protected, as well your entire application. - That is the reason the public folder is there, security. - The only directories that you can see in your browser if you set the document root to the public folder is the folders that are there, like the styles and scripts.

    https://laracasts.com/discuss/channels/general-discussion/how-do-you-protect-env-file-from-public

    Check the folder structure on your hosting and make sure the public folder is the document root.

提交回复
热议问题