0

Every time if I put a file into the doc dir of nginx by using the mv command, it always results in a 403 Forbidden error, but if I do that by using the cp command, no error occurs.

I tried very large and very small files, and tried putting files whether or not nginx is alive, and tried clearing the cache dir of nginx, but the problem still raised.

Has someone resolved a problem like this?

Dave M
  • 4,494
  • 21
  • 30
  • 30
Leon
  • 159
  • 7
  • Possible duplicate of [Fedora 16: "Permission denied: file permissions deny server access"](https://serverfault.com/questions/381760/fedora-16-permission-denied-file-permissions-deny-server-access) – Magellan Nov 30 '19 at 19:22

1 Answers1

0

Probably it is a problem of UNIX permissions and ownership. mv can preserve ownership of file in situation where cp can't, e.g. when you use it as unprivileged user. Cf. this question.

To check the ownership of files you can do:

ls -l /path/to/web/root/directory

or use stat for single files.

Piotr P. Karwasz
  • 5,292
  • 2
  • 9
  • 20