django - 使用 django 和 apache2 设置权限的正确方法?

标签 django permissions apache2 apache chmod

我在 apache2 上使用 django 和 wsgi

我试图访问我的 site/static/css 文件夹中的一个 css 文件,由于权限为 644,因此 apache2 无法访问该 css 文件。

所以我在 site/static/css 文件夹中 chmod 645 一切正常。但是,我担心将 css 文件夹中的任何内容授予所有人执行权限可能会导致安全问题。解决这个问题的正确方法是什么,也许是使用 httpd.conf 文件授予某些权限的方法?

谢谢!

最佳答案

您可以使用 chown 使文件属于与 apache 相同的组(www-data?),然后设置该组的权限而不是所有人。

关于django - 使用 django 和 apache2 设置权限的正确方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6559456/

相关文章:

javascript - jQuery、Ajax、WP、发布 4000B 长文本 : 404 not found (2000B=OK)?

django - 如何在表单验证错误 Django 上预填充图像字段?

python - 关于 pythonanywhere : trouble running the django-admin shell 的 Django 教程

ios - 请求权限以允许访问联系人 iOS

php - Facebook API 权限的 fatal error

perl - 为什么运行 Apache+FastCGI 的 Catalyst 应用程序不提供动态内容?

apache - htaccess : I cannot allow access from a specific domain instead of IP

python - 如何使用迁移来移动数据

python - 如何将Python模块添加到docker容器中?

MySQL 用户访问 - 特定于表