I'm generating html cache using drupal 7 boost module. I'm using a load balancer server and html cache files are in node 1, node 2 and node 3.
If this cache folder has 775 permission with owner as "root" and Group as "root", When user access page, there is permission issue in the drupal logs as "The file permissions could not be set on cache/normal/IP_ADDRESS/PATH_TO_FILE/NAME_OF_THE_FILE.html".(& cache files are not regenerating)

If this cache folder has 775 permission with owner as "apache" and Group as "apache", When user access page, there is no permission issue. But cache is regenerate evertime when user access the page.

Is this issue occured due to server permission? or due to drupal boost configuration.

Following are the .htacces boost settings.

### 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 ###

Comments

Anonymous’s picture

It is due to your server configuration, something is running as root (which it shouldn't be) do a

chmod -Rv apache. /YOUR_DRUPAL_FOLDER/cache

should sort it out if you have shell access. The oddest thing is that PHP does the deleting and the creating and there is no logical reason why it should be running as two differing users, unless you have somehow managed to configure cron to run as a separate root process.

wsinghe’s picture

At the moment cache folder is added the permission like this,

/MY_DRUPAL_FOLDER/cache apache:apache
/MY_DRUPAL_FOLDER/cache 0775

The html cron run as root

The cron is running without a issue. If I access a cache page from a load balancer ip address, it is generating the cache again and that new generated html cache file owner is apache user. And the cache tag on the source code of the page time is getting current time. If I refresh the page again, it is generating cache again. And show generated time as current time.