NGINX权限问题-在Postman中尝试PUT时出现HTTP错误409

问题描述

我已经继承了该服务器,所以我对Nginx并没有太多的经验。但是在我开始进行更改和弄乱之前,我想看看是否能在这里找到一些帮助。

服务器显示主页,可以从那里访问这些目录。 GET方法有效。 POST没有在web-dav指令中设置,但是尝试时得到403。我检查了access.log,看到的只是GET查询。 error.log显示以下内容,但是...

2020/08/27 13:43:12 [crit] 31561#0:* 1 open()“ / usr / share / Nginx / html / tmp / 0000000001”失败(13:权限被拒绝),客户端:myClient .CPE,服务器:server.CPE,请求:“ PUT /Tech_Support_Files/2020-08-27T13:43:10_224806691313312_TSI.tar.gz.aes HTTP / 1.1”,主机:“ server.CPE” 2020/08/27 13:44:12 [crit] 31561#0:* 2 open()“ / usr / share / Nginx / html / tmp / 0000000002”失败(13:权限被拒绝),客户端:myClient.CPE,服务器:server.CPE,请求:“ PUT /Tech_Support_Files/2020-08-27T13:43:10_224806691313312_TSI.tar.gz.aes HTTP / 1.1”,主机:“ server.CPE” 2020/08/27 13:45:13 [crit] 31561#0:* 3 open()“ / usr / share / Nginx / html / tmp / 0000000003”失败(13:权限被拒绝),客户端:myClient.CPE,服务器:server.CPE,请求:“ PUT /Tech_Support_Files/2020-08-27T13:43:10_224806691313312_TSI.tar.gz.aes HTTP / 1.1”,主机:“ server.CPE”

因此,这里似乎存在权限问题,但我显然找不到该文件的来源。这是我的ls -l尝试与之协商的目录,对我来说看起来很合适...

/usr/share/Nginx/html
total 12
-rw-r--r--. 1 Nginx Nginx 3650 Oct  3  2019 404.html
-rw-r--r--. 1 Nginx Nginx 3693 Oct  3  2019 50x.html
lrwxrwxrwx. 1 Nginx Nginx   20 Apr 13 14:57 en-US -> ../../doc/HTML/en-US
drwxr-xr-x. 2 Nginx Nginx   27 Apr 13 14:57 icons
lrwxrwxrwx. 1 Nginx Nginx   18 Apr 13 14:57 img -> ../../doc/HTML/img
lrwxrwxrwx. 1 Nginx Nginx   25 Apr 13 14:57 index.html -> ../../doc/HTML/index.html
-rw-r--r--. 1 Nginx Nginx  368 Oct  3  2019 nginx-logo.png
lrwxrwxrwx. 1 Nginx Nginx   14 Apr 13 14:57 poweredby.png -> nginx-logo.png
drwxrwxr-x. 2 Nginx Nginx   22 Aug 21 16:59 Tech_Support_Files
drwxrwxr-x. 2 Nginx Nginx    6 Aug 25 18:48 tmp

非常感谢您对此工作有任何见识。这是当前的.conf文件...

user Nginx;
worker_processes auto;
error_log /var/log/Nginx/error.log;
pid /run/Nginx.pid;

include /usr/share/Nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/Nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   75;
types_hash_max_size 2048;

include             /etc/Nginx/mime.types;
default_type        application/octet-stream;

include /etc/Nginx/conf.d/*.conf;

 server {
     listen       443 ssl http2 default_server;
     listen       [::]:443 ssl http2 default_server;
     server_name  CPE_Uploads;
     root         /usr/share/Nginx/html;

     include /etc/Nginx/self-signed.conf;
     include /etc/Nginx/default.d/*.conf;

     add_header Strict-Transport-Security "max-age=7200";
     add_header "allow: GET,PUT,HEAD,PURGE,DELETE,PATCH" always;
  
     location / {
     root /usr/share/Nginx/html;
     auth_basic "Restricted Site.";
     auth_basic_user_file /etc/Nginx/auth/Tech_Support_Files;
     client_body_temp_path /usr/share/Nginx/html/tmp/;
     client_body_buffer_size 1M;
     client_max_body_size 8M;
     dav_methods PUT DELETE MKCOL copY MOVE;
     create_full_put_path on;
     dav_access user:rw group:rw all:rw;
     autoindex on;
     }

     error_page 404 /404.html;
         location = /40x.html {
     }

     error_page 500 502 503 504 /50x.html;
         location = /50x.html {
     }
  }

}

解决方法

此问题已通过将所有内容移至nginx用户主目录中来解决。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...