将PHP应用程序文件夹放在public_html之上 [英] Placing the PHP application folder above public_html

查看:99
本文介绍了将PHP应用程序文件夹放在public_html之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个线程中看到,在一些框架中看到,建议使用以下结构。有人可以解释为什么,在安全方面(如果你可以彻底地解释一下会不会被赞赏)?还有其他优点吗?




  • root

    • app

      • application_folder

      • 配置

      • 控制器

      • >

    • public_html

      • css

      • js

      • 图片

      • index.php

      • .htaccess

      / li>



编辑:



如果服务器遭到黑客攻击,这是否有任何影响?

解决方案

这个想法是只有应该能够用户访问的内容将被放置在 public_html 中,以便互联网上的随机人员无法访问您的代码或数据的随机片段,如果他们猜测正确的URL。



通常的方法是在应用程序内部有一个公用文件夹,然后将其符号链接到public_html或以下,而不是将应用程序实际分为两部分。


I saw in a thread and seen in some frameworks, that using the below structure is recommended. Can someone please explain why, in terms of security (if you can explain it thoroughly would be appreciated)? Are there any other advantages of this?

  • root
    • app
      • application_folder
      • config
      • controllers
      • models
    • public_html
      • css
      • js
      • images
      • index.php
      • .htaccess

EDIT:

Does this have any effect if the server was hacked?

解决方案

The idea is that only the things that should be able to be accessed by the user are placed in public_html, so that random people on the Internet can't access random pieces of your code or data if they guess the right URL.

The usual way this is done is to have a public folder inside the app which is then symlinked to public_html or under, and not actually split the application in two parts.

这篇关于将PHP应用程序文件夹放在public_html之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆