0

我的专用根服务器上有一个脚本(类似于 youtube),但我无法上传大型视频文件。

我收到此错误消息:

413 请求实体太大 nginx

程序员写了一个php文件,直接显示错误信息。

我已经调整了nginx.conf,但错误仍然存​​在。

#user  nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

include /etc/nginx/modules.conf.d/*.conf;

events {

    worker_connections 1024;

}

http {

    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 4096M;

    #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;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server_tokens off;

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

    server {

       client_max_body_size 4096M;

    location / {

       client_max_body_size 4096M;

    }
  }
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;

这些数据设置在php.ini

  • PHP 7.0.33
  • memory_limit 4096M
  • 最大执行时间 7200
  • 最大输入时间 7200
  • post_max_size 4096M upload_max_filesize 4096M

有人能帮我吗?我必须在哪里进行更改才能上传大型视频文件。

谢谢!

4

1 回答 1

0

您所拥有的很棒,将其添加client_max_body_size 4096M;到您的 nginx 默认文件或您创建的任何内容中。

我所说的这个文件位于站点可用目录中。

完成文件编辑后,重新加载守护进程,然后重新启动 nginx。

从上面的内容中删除或注释掉位置块中的那个。

让我知道这是否有帮助

于 2019-04-06T08:14:10.153 回答