【问题标题】:413 Request Entity Too Large nginx413 请求实体太大 nginx
【发布时间】:2015-01-25 22:35:13
【问题描述】:

我正在尝试通过如下更改 nginx.conf 将我的 PHP 应用程序的上传限制增加到 512MB -

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


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 512M;
    #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  6500;
    #tcp_nodelay        on;

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

    server_tokens off;

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

但它似乎仍被限制在 120MB

请有人帮忙修改以接受超过 120mb 的文件

谢谢你..

【问题讨论】:

  • 这是服务器的一部分,现在如果你想通过php上传你也必须增加限制(在php.ini中)见stackoverflow.com/questions/2184513/… ...不要忘记重新启动nginx ;)
  • 是的,我也通过 .htaccess 进行了如下更改 - php_value max_execution_time 600 php_value upload_max_filesize 512M php_value post_max_size 512M php_value memory_limit 512M 还有重载和重启 nginx 的区别吗?
  • 重新加载会刷新设置,重新启动确实会完全终止网络服务器并且它暂时不可用,我认为重新加载不应该发生这种情况。您是否允许您的 .htaccess 覆盖 php.ini?这篇文章是关于这个的:stackoverflow.com/questions/7841709/…
  • 我刚刚用 phpinfo();新的价值观正在体现。
  • 刚刚发现这个帖子:rtcamp.com/tutorials/php/increase-file-upload-size-limit你可能也需要增加超时限制,你可以尝试重新加载php5-fpm以及nginx

标签: php nginx


【解决方案1】:

查看你的 php.ini 文件:

; Maximum allowed size for uploaded files.
upload_max_filesize = 512M

; Must be greater than or equal to upload_max_filesize
post_max_size = 512M

它需要匹配你的 nginx 配置

【讨论】:

    猜你喜欢
    • 2017-08-28
    • 2016-04-30
    • 2016-05-27
    • 2016-08-27
    • 2021-06-29
    • 2019-12-13
    • 2019-09-02
    • 2021-11-13
    • 2016-02-01
    相关资源
    最近更新 更多