上传时 Nginx 出现空间不足问题

上传时 Nginx 出现空间不足问题

我的 nginx 服务器有问题。它是一个存储服务器,当我想上传文件(2.5G)时,我可以在我的 error.log 上显示任何错误

2016/02/08 03:26:24 [crit] 7843#0: *1154 pwrite() "/var/lib/nginx/body/0000000388" failed (28: No space left on device), client: 78.229.62.244, server: www1.mywebsite.net, request: "POST /upload/ HTTP/1.1", host: "www1.mywebsite.net", referrer: "http://www.mywebsite.net/" 2016/02/08 03:28:37 [crit] 7843#0: *1476 pwrite() "/var/lib/nginx/body/0000000526" failed (28: No space left on device), client: 78.229.62.244, server: www1.mywebsite.net, request: "POST /upload/ HTTP/1.1", host: "www1.mywebsite.net", referrer: "http://www.mywebsite.net/" 2016/02/08 03:29:45 [crit] 7844#0: *1518 pwrite() "/var/lib/nginx/body/0000000550" failed (28: No space left on device), client: 78.229.62.244, server: www1.mywebsite.net, request: "POST /upload/ HTTP/1.1", host: "www1.mywebsite.net", referrer: "http://www.mywebsite.net/" 2016/02/08 03:32:50 [crit] 7846#0: *1572 pwrite() "/var/lib/nginx/body/0000000588" failed (28: No space left on device), client: 78.229.62.244, server: www1.mywebsite.net, request: "POST /upload/ HTTP/1.1", host: "www1.mywebsite.net", referrer: "http://www.mywebsite.net/" 2016/02/08 03:33:23 [crit] 7846#0: *1579 pwrite() "/var/lib/nginx/body/0000000592" failed (28: No space left on device), client: 78.229.62.244, server: www1.mywebsite.net, request: "POST /upload/ HTTP/1.1", host: "www1.mywebsite.net", referrer: "http://www.mywebsite.net/"

这是我的 df -h: root@www1:/etc/nginx/sites-enabled# df -h Filesystem Size Used Avail Use% Mounted on /dev/md2 96G 20G 72G 22% / udev 10M 0 10M 0% /dev tmpfs 6.3G 33M 6.3G 1% /run tmpfs 16G 0 16G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 16G 0 16G 0% /sys/fs/cgroup /dev/md3 1.7T 285G 1.4T 18% /home

我的网站配置:

upstream mywebsite { server localhost:8000; }

server { listen 80; server_name mywebsite.log; access_log /var/log/nginx/mywebsite.access.log; error_log /var/log/nginx/mywebsite.error.log; client_max_body_size 10240M;

location / {
    proxy_pass http://127.0.0.1:8000;
    proxy_pass_header Server;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Scheme $scheme;
    proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_read_timeout 1200;
}

}

Nginx 配置:

root@www1:/etc/nginx# cat nginx.conf 用户 www-data; worker_processes 4; pid /run/nginx.pid; 事件 { worker_connections 1024; 使用 epoll; multi_accept on; } http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

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

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}

一点 df -i:

抱歉,这是我的 df -i。

root@sd-87855:/etc/nginx# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda3 61038592 51533 60987059 1% / udev 8250054 355 8249699 1% /dev tmpfs 8260392 457 8259935 1% /run tmpfs 8260392 1 8260391 1% /dev/shm tmpfs 8260392 3 8260389 1% /run/lock tmpfs 8260392 13 8260379 1% /sys/fs/cgroup /dev/sda2 48960 328 48632 1% /boot /dev/sda5 594759680 115967 594643713 1% /home

谢谢您的帮助,祝您有美好的一天 ;-)

答案1

对于我来说,这个问题是通过将临时主体存储指向具有足够空间的文件位置来解决的。

client_body_temp_path /spool/nginx/client_temp 1 2;

查看更多客户端主体临时路径在文档中。

相关内容