HTTP 413:请求太大



使用Apache 2.4&Ubuntu 18.04上的PHP 7.4。默认的Apache conf文件。我正试图将约700个jpegs(总计约100MB,最大的约1MB(上传到Laravel应用程序,对于单个应用程序,它可以工作,但对于我得到的较大请求大小:

服务器返回一个";413有效载荷太大";。

站点配置看起来像:

<VirtualHost *:443>
ServerName server.domain.com
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
ProxyPreserveHost On
ProxyPass "/" "http://127.0.0.1:8000/"
ProxyPassReverse "/" "http://127.0.0.1:8000/"
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/privkey.pem
LogLevel debug
</VirtualHost>

/etc/php/7.4/apache2/hp.ini具有:

max_execution_time = 3600
max_input_time = 3600
memory_limit = 512M
post_max_size = 0 #Unlimited
file_uploads = On
upload_max_filesize = 100M
max_file_uploads = 2000

我在申请后重新启动了Apache。我在我的访问中看到POST请求。日志:

"POST /i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1 HTTP/1.1" 413 1562

和错误日志中的(正常外观(调试日志:

[ssl:debug] [pid 5395] ssl_engine_kernel.c(415): [client ip:1027] AH02034: Initial (No.1) HTTPS request received for child 7 (server server.domain.com:443), referer: https://server.domain.com/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1
[authz_core:debug] [pid 5395] mod_authz_core.c(845): [client ip:1027] AH01628: authorization result: granted (no directives), referer: https://server.domain.com/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1
[proxy:debug] [pid 5395] mod_proxy.c(1253): [client ip:1027] AH01143: Running scheme http handler (attempt 0), referer: https://server.domain.com/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1
[proxy_fcgi:debug] [pid 5395] mod_proxy_fcgi.c(1019): [client ip:1027] AH01076: url: http://127.0.0.1:8000/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1 proxyname: (null) proxyport: 0, referer: https://server.domain.com/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1
[proxy_fcgi:debug] [pid 5395] mod_proxy_fcgi.c(1024): [client ip:1027] AH01077: declining URL http://127.0.0.1:8000/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1, referer: https://server.domain.com/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1
[proxy:debug] [pid 5395] proxy_util.c(2325): AH00942: HTTP: has acquired connection for (127.0.0.1)
[proxy:debug] [pid 5395] proxy_util.c(2379): [client ip:1027] AH00944: connecting http://127.0.0.1:8000/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1 to 127.0.0.1:8000, referer: https://server.domain.com/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1
[proxy:debug] [pid 5395] proxy_util.c(2588): [client ip:1027] AH00947: connected /i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1 to 127.0.0.1:8000, referer: https://server.domain.com/i/import/job/11c1893c-d775-46d7-9df8-1a6fafcc96f2/1
[proxy:debug] [pid 5395] proxy_util.c(3054): AH02824: HTTP: connection established with 127.0.0.1:8000 (127.0.0.1)
[proxy:debug] [pid 5395] proxy_util.c(3240): AH00962: HTTP: connection complete to 127.0.0.1:8000 (127.0.0.1)
[proxy:debug] [pid 5395] proxy_util.c(2340): AH00943: http: has released connection for (127.0.0.1)
[ssl:debug] [pid 5395] ssl_engine_io.c(1102): [client ip:1027] AH02001: Connection closed to child 7 with standard shutdown (server server.domain.com:443)

我在应用程序日志中没有看到任何相关内容。还尝试在apache2.conf中设置LimitRequestBody,但也无济于事。

Artisan Serve-Laravel应用程序正在使用它来启动服务器,在php-cli使用php.ini,而不是在php-apachephp-fpm修改配置,解决了这个问题。

最新更新