- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 Capifony 多阶段部署将我的 Symfony2 网络应用部署到 Ubuntu 机器上的 Apache 网络服务器上,托管在 AWS 上。
我有用户设置
set :user, "ubuntu"
像这样设置缓存的可写目录
set :writable_dirs, ["app/cache"]
set :webserver_user, "www-data"
set :use_set_permissions, true
set :permission_method, :acl
除了运行时,一切都部署良好
executing "setfacl -R -m u:ubuntu:rwx -m u:www-data:rwx /var/www/releases/20140310012814/app/cache"
我收到多个操作不允许的错误,例如
setfacl: /var/www/releases/20140310012814/app/cache/prod/classes.php: Operation not permitted
似乎用户(大概是“www-data”)无法对“ubuntu”创建的文件设置权限。但是,我已经从/var/www/current 目录在服务器上运行了以下命令,但我不完全确定它们的作用:
sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/cache
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache
这是一些 acl 信息
getfacl app/cache
# file: app/cache
# owner: ubuntu
# group: ubuntu
user::rwx
user:www-data:rwx
user:ubuntu:rwx
group::rwx
mask::rwx
other::rwx
default:user::rwx
default:user:www-data:rwx
default:user:ubuntu:rwx
default:group::rwx
default:mask::rwx
default:other::rwx
我看过类似的问题 here我应该运行类似的东西吗?比如:
sudo sh -c 'setfacl -R -m u:ubuntu:rwX -m u:www-data:rwX /var/www/current/app/cache'
谢谢
最佳答案
Capifony 有一个食谱条目解释了如何 automatically set proper permissions .基本上你需要的是:
set :writable_dirs, ["app/cache", "app/logs"]
set :webserver_user, "www-data"
set :permission_method, :acl
set :use_set_permissions, true
:use_sudo
不需要是 true
只要 :writable_dirs
属于 :user
>.
setfacl: /var/www/releases/20140310012814/app/cache/prod/classes.php: Operation not permitted
此消息表示任务运行时缓存目录不为空(setfacl
对该目录中的 prod/classes.php
进行操作),这是 < em>不 属于:user
(不允许setfacl
)。
文件不属于:user
的事实是很正常的,因为网络服务器会创建大量缓存文件,从而使它们属于:webserver_user
。
奇怪的是缓存目录不是空的。通常新版本应该有一个空的缓存目录。一个常见的原因是缓存目录是共享的,这意味着您已将其添加到 :shared_children
。如果是这样,请将其删除。不应共享缓存目录。
如果不是这种情况,则尝试找出运行 setfacl
任务时缓存目录不为空的原因。也许其他任务即将运行。
如果你真的想要一个共享目录对网络服务器来说是可写的怎么办?这实际上很常见,想想应该共享的 media
或 uploads
目录。
应该在实际的共享目录上设置权限,而不是发布目录中的符号链接(symbolic link)。只要 :writable_dirs
中的完全相同的短语也在 :shared_children
中,Capifony 会为您处理这件事。
# this will work:
set :shared_children, ["web/uploads"]
set :writable_dirs, ["web/uploads"]
# this will also work:
set :web_path, "web" # is default
set :shared_children, [web_path + "/uploads"]
set :writable_dirs, ["web/uploads"]
# this will not:
set :web_path, "web" # is default
set :shared_children, [web_path + "/uploads"]
set :writable_dirs, ["web/uploads/"] # trailing /
请检查错误中提到的目录是否是实际的共享目录(不是符号链接(symbolic link))。
共享目录的所有者必须是将运行 setfacl
命令的用户。换句话说,它必须是 :user
。当您更改了 :user
的值,或者在过去启用了 :use_sudo
时,这可能会导致问题。请检查目录(在 :writable_dirs
中设置)是否确实属于 :user
。
Capifony 将检查权限是否已设置。如果是这样,它就不会再尝试这样做了。这是通过以下命令完成的:
getfacl --absolute-names --tabular #{dir} | grep #{webserver_user}.*rwx | wc -l"
尝试手动运行此命令(将 #{dir}
和 #{webserver_user}
替换为实际值)以查看结果。如果它没有产生任何结果,则 Capifony 会假定权限尚未设置,并将尝试这样做。
在这种情况下,请使用 getfacl
手动检查权限。如果它们确实不正确,请手动设置它们(再次替换 #{user}
、#{webserver_user}
和 #{dir}
)使用“根的力量”:
sudo setfacl -R -m u:#{user}:rwX -m u:#{webserver_user}:rwX #{dir}
sudo setfacl -dR -m u:#{user}:rwx -m u:#{webserver_user}:rwx #{dir}
然后再次运行 Capifony。如果一切顺利,这次应该会成功!
关于Symfony2 Capifony deploy setfacl 缓存目录不允许操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22297397/
我阅读了有关 JSR 107 缓存 (JCache) 的内容。 我很困惑:据我所知,每个 CPU 都管理其缓存内存(无需操作系统的任何帮助)。 那么,为什么我们需要 Java 缓存处理程序? (如果C
好吧,我是 jQuery 的新手。我一直在这里和那里搞乱一点点并习惯它。我终于明白了(它并不像某些人想象的那么难)。因此,鉴于此链接:http://jqueryui.com/sortable/#dis
我正在使用 Struts 2 和 Hibernate。我有一个简单的表,其中包含一个日期字段,用于存储有关何时发生特定操作的信息。这个日期值显示在我的 jsp 中。 我遇到的问题是hibernate更
我有点不确定这里发生了什么,但是我试图解释正在发生的事情,也许一旦我弄清楚我到底在问什么,就可能写一个更好的问题。 我刚刚安装了Varnish,对于我的请求时间来说似乎很棒。这是一个Magneto 2
解决 Project Euler 的问题后,我在论坛中发现了以下 Haskell 代码: fillRow115 minLength = cache where cache = ((map fill
我正试图找到一种方法来为我网络上的每台计算机缓存或存储某些 python 包。我看过以下解决方案: pypicache但它不再被积极开发,作者推荐 devpi,请参见此处:https://bitbuc
我想到的一个问题是可以从一开始就缓存网络套接字吗?在我的拓扑中,我在通过双 ISP 连接连接到互联网的 HAProxy 服务器后面有 2 个 Apache 服务器(带有 Google PageSpee
我很难说出不同缓存区域 (OS) 之间的区别。我想简要解释一下磁盘\缓冲区\交换\页面缓存。他们住在哪里?它们之间的主要区别是什么? 据我了解,页面缓存是主内存的一部分,用于存储从 I/O 设备获取的
1.题目 请你为最不经常使用(LFU)缓存算法设计并实现数据结构。 实现 LFUCache 类: LFUCache(int capacity) - 用数据结构的容量 capacity 初始化对象 in
1.题目 请你设计并实现一个满足 LRU (最近最少使用) 缓存 约束的数据结构。 实现 LRUCache 类: ① LRUCache(int capacity) 以正整数作为容量 capacity
我想在访问该 View 时关闭某些页面的缓存。它适用于简单查询模型对象的页面。 好像什么时候 'django.middleware.cache.FetchFromCacheMiddleware', 启
documents为 ExePackage element state Cache属性的目的是 Whether to cache the package. The default is "yes".
我知道 docker 用图层存储每个图像。如果我在一台开发服务器上有多个用户,并且每个人都在运行相同的 Dockerfile,但将镜像存储为 user1_myapp . user2 将其存储为 use
在 Codeigniter 中没有出现缓存问题几年后,我发现了一个问题。我在其他地方看到过该问题,但没有适合我的解决方案。 例如,如果我在 View 中更改一些纯 html 文本并上传新文件并按 F5
我在 Janusgraph 文档中阅读了有关 Janusgraph Cache 的内容。关于事务缓存,我几乎没有怀疑。我在我的应用程序中使用嵌入式 janusgrah 服务器。 如果我只对例如进行读取
我想知道是否有来自终端的任何命令可以用来匹配 Android Studio 中执行文件>使缓存无效/重新启动的使用。 谢谢! 最佳答案 According to a JetBrains employe
我想制作一个 python 装饰器来内存函数。例如,如果 @memoization_decorator def add(a, b, negative=False): print "Com
我经常在 jQuery 事件处理程序中使用 $(this) 并且从不缓存它。如果我愿意的话 var $this = $(this); 并且将使用变量而不是构造函数,我的代码会获得任何显着的额外性能吗?
是的,我要说实话,我不知道varnish vcl,我可以解决一些基本问题,但是我不太清楚,这就是为什么我遇到问题了。 我正在尝试通过http请求设置缓存禁止,但是该请求不能通过DNS而是通过 Varn
在 WP 站点上加载约 4000 个并发用户时遇到此问题。 这是我的配置: F5 负载均衡器 ---> Varnish 4,8 核,32 Gb RAM ---> 9 个后端,4 个核,每个 16 RA
我是一名优秀的程序员,十分优秀!