source url: http://blog.netgusto.com/solving-web-file-permissions-problem-once-and-for-all/
If like us you develop Web applications and deploy them on Linux servers (development or production environments), you might have wondered how to handle file permissions on the application files in a simple and fool-proof way.
Developers operating on the server require specific file permissions on the application files to be able to read and write them (for obvious reasons).
The web server (Apache, nginx, Lighttpd, etc.) also requires specific file permissions on the application files to be able to read them, and for some files (but not all files), to be able to write them (like for instance, when uploading a file, or creating a thumbnail, etc.)