现象:
文件上传接口 报错403,其余接口正常;
经尝试,当文件较小时,上传成功;但是文件超过10k时,报错403
合理怀疑是ngnix 配置问题,查看nginx日志:
一般来说 /usr/local/nginx/logs 下存在日志;查看error.log
2023/10/09 17:31:56 [crit] 113148#0: *37499 open() "/usr/local/nginx/client_body_temp/0000000292" failed (13: Permission denied), client: xxx.xx.xx.xxx, server: localhost, request: "POST/xxxxxxx /upload/1711312440346918912 HTTP/1.1", host: "xxx.xx.xx.xxx:8080", referrer: "http://xxx.xx.xx.xxx:8080/xxxxxx" 2023/10/09 17:31:56 [error] 113148#0: *37499 open() "/usr/local/nginx/html/50x.html" failed (13: Permission denied), client: xxx.xx.xx.xxx, server: localhost, request: "POST /xxxxxxx /upload/1711312440346918912 HTTP/1.1", host: "xxx.xx.xx.xxx:8080", referrer: "http://xxx.xx.xx.xxx:8080/xxxxxx"
错误日志如上
解决方案:
有日志可见为权限问题;
给日志中 报错的路径 "/usr/local/nginx/client_body_temp/ 加上权限;
"sudo chmod -R777 /usr/local/nginx/client_body_temp/';
==================
查询资料,也有通过修改用户权限解决问题:即在nginx.conf 文件中 增加 user root;
该属性只要在用超户启动时才会生效,
但是修改之后并不能解决问题,无效;
参考文章:
https://blog.csdn.net/cjxshiwo/article/details/132539535
标签:运维,xxx,nginx,xx,报错,usr,local From: https://www.cnblogs.com/CccccNun/p/17762745.html