【问题标题】:Drupal boost cache overwrite every time每次 Drupal 提升缓存覆盖
【发布时间】:2014-02-27 14:03:43
【问题描述】:

我正在使用 drupal 7 boost 模块生成 html 缓存。我正在使用负载平衡器服务器,html 缓存文件位于节点 1、节点 2 和节点 3 中。 如果此缓存文件夹有 775 权限,所有者为“root”,组为“root”,当用户访问页面时,drupal 日志中的权限问题为The file permissions could not be set on cache/normal/IP_ADDRESS/PATH_TO_FILE/NAME_OF_THE_FILE.html(& 缓存文件未重新生成)

如果这个缓存文件夹有775权限,所有者为apache,组为apache,当用户访问页面时,没有权限问题。但是每次用户访问页面时都会重新生成缓存。

这个问题是因为服务器权限造成的吗?或由于 drupal boost 配置。

以下是 .htacces 增强设置。

### BOOST START ###

# Allow for alt paths to be set via htaccess rules; allows for cached variants (future mobile support)
RewriteRule .* - [E=boostpath:normal]

# Caching for anonymous users
# Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
RewriteCond %{REQUEST_URI} (^/vc/vacanze-in-montagna/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|    register))$) [OR]
RewriteCond %{HTTPS} on [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule .* - [S=3]

# GZIP
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=1]
RewriteCond %{DOCUMENT_ROOT}/vc/vacanze-in-montagna/cache/%{ENV:boostpath}/LOAD_BALANCER_IP%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
RewriteRule .* cache/%{ENV:boostpath}/LOAD_BALANCER_IP%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1]

# NORMAL
RewriteCond %{DOCUMENT_ROOT}/vc/vacanze-in-montagna/cache/%{ENV:boostpath}/LOAD_BALANCER_IP%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/%{ENV:boostpath}/LOAD_BALANCER_IP%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

### BOOST END ###

【问题讨论】:

  • 您找到解决方案了吗?我也有类似的问题。
  • 也有兴趣听到解决方案 - 仅在主页有同样的问题。

标签: php apache drupal-7 load-balancing drupal-boost


【解决方案1】:

由于您没有留下太多信息,因此这里有一些猜测:

  1. 您的网络服务器用户不是“apache”或组有误?
  2. 您忘记启用 mod_rewrite?或者忘记了 .htaccess 的允许 AllowOverride?
  3. 您弄乱了 .htaccess 文件并将增强设置粘贴到了错误的位置? (发生在我身上一次...)
  4. 您以某种方式在 /var/www/mysite/SUBPATH/ 之类的子路径中安装了 drupal,但将 url 指向“mysite”路径? (我想这可能会弄乱重写规则)
  5. 您是否尝试将该目录添加为“apache”用户?比如:runuser -l apache -c 'mkdir /your/drupal/dir/newdir'? -> 如果这不起作用,您知道这是权限问题。
  6. 我的想法不多了....

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 2011-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-16
    相关资源
    最近更新 更多