Can't delete files when nginx is running

Ayub asked:

On Debian Squeeze, when nginx is running, it puts a handle on my development files (css, html) and I am unable to delete them unless I stop nginx. This is a problem because it’s my development environment (I wouldn’t care if it was production), is there any setting I can switch so it doesn’t put a lock on all my files?

My answer:

Best guess is:

Your files aren’t actually on a UNIX or Linux filesystem, but on a Windows-based filesystem, either mounted locally (NTFS) or remotely via SMB/CIFS. These filesystems don’t permit one process to remove a file being used by another process.

On a normal UNIX or Linux filesystem, you could replace the file with no issues, and the process that had the file open would still use the old file until it closed it, at which point it would be permanently deleted.

The solution here is to move your files off the NTFS or CIFS share and onto a native filesystem.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.