Nginx causes a big file that cannot be uploaded due to permissions

1. After using the nginx proxy, when the application uploads files, it is found that small files can be uploaded, but large files cannot be uploaded. Check the nginx log and find this sentence: client intended to send too large body

Add client_max_body_size 1024m to the server of the nginx.conf configuration file;

Restart nginx and upload I still can’t upload large files, but there is no client intended to send too large body log in the background.

There are logs in the background, such as: 2019/08/02 18:37:35 [crit] 437115#0: *34 open() “/ usr/local/nginx/client_body_temp/0000000009” failed (13: Permission denied). And small files can be uploaded.

2. Edit the nginx.conf file again and add user root at the beginning;

# user nobody;
user root;
worker_processes 1;

3, restart nginx again , Large files can be uploaded.

4. Problem analysis: I haven’t analyzed it carefully yet.

But I think the reason might be that nginx runs as the default user nobody before adding user root. When uploading files with nginx, large files must be cached in a certain directory and then forwarded to the application. , But the authority of the nobody user is too small and the file cannot be written. The small files are not cached and forwarded directly to the application. I’ll analyze it carefully next time I have time.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4643 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.