doudaiyao0934 2014-01-20 17:55
浏览 51

PHP / Apache2生产Web权限和所有权

I was always curious what is the best practice for production web pages ran by Apache2 and PHP of folder ownerships and permissions.

Lets say /srv/www/my-web is a public folder accessed via http.

How the ownership and permissions should be set to be as restrictive as possible?

My example would be:

drwxr-xr-x my-user:www-data /srv/www/my-web
-rw-r--r-- my-user:www-data /srv/www/my-web/index.php    

drwxrwxr-x my-user:www-data /srv/www/my-web/cache
-rw-rw-r-- my-user:www-data /srv/www/my-web/auto-generated-file.php
  • 写回答

1条回答 默认 最新

  • dongqiao8417 2014-01-20 18:15
    关注

    Typically:

    Folders: 755 or rwxr-xr-x
    Files: 644 or rw-r--r--
    
    find /[webroot] -type d -exec chmod 755 {} \; //set all directories to 755
    find /[webroot] -type f -exec chmod 644 {} \; // set all files to 644
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器