0

I'm using a nginx webserver with the fastcgi caching. The fastcgi_cache_path is set to an sub directory of the webroot of each virtual host from nginx. (eg. /var/html/user01/httpdocs/nginx_cache ... /var/html/user02/httpdocs/nginx_cache.

The caching itselfs works fine as i can see in the response headers (x-cache hit) and the saved data in the nginx_cache directorys.

So when i look at the nginx_cache directorys i can see that the owner is always nginx. What i wanted to do, is to set permanently the permissions (read/delete) for the users (user01, user02, ...) for their nginx_cache folder.

What i already tryed: - change recursive all rights to user0x (will be overwritten by nginx for changes and new files) - search for an nginx configuration (only found nginx_store_access which also not work)

How can i solve this problem?

1 Answers1

0

First, you should not store the cache folder under the web root /var/www/html/user01/httpdocs, since then you are making the cache contents public for all web visitors. Move it to /var/www/html/user01 level, then the contents are not accessible.

What comes to the file permissions, you could try applying an ACL to the cache directory like the following:

setfacl -d -m u:user01:rw ngx_cache

This assigns an ACL to the ngx_cache directory which makes all files inside the cache directory readable and writable by user01.

Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58