Allow PHP to delete Nginx cache files

  • Posted on November 10, 2014
  • tillAsked by till


I’m using the Nginx FastCGI cache on Debian 7 and I’d like to allow PHP to delete Nginx’s cache files.

PHP-FPM runs as www-data. Nginx runs as nginx.

/var/cache/nginx owner and group is root, permissions are 755 (drwxr-xr-x).

Directories in /var/cache/nginx are owned by nginx, group is root, permissions are 700 (rwx------). Files in /var/cache/nginx owner and group is nginx, permissions are 600 (rw-------).

How can permanently allow the user www-data to delete files in /var/cache/nginx?

I have minimal knowledge about unix user/groups or filesystem ACL’s, any leads appreciated!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Doh, thank you for the hint. I just changed the user in nginx.conf to www-data and it works perfectly. Thanks a lot!