如何解决"413 Request Entity Too Large nginx/1.1.19"错误?



当我试图在我的apache2,Laravel服务器上上传文件时,我得到了这个错误:

413请求实体太大


nginx/1.1.19

这当然意味着我的文件太大了。

但我更改了php.ini

最大文件加载20

后置_max_size 20M

上传_max_filesize 25M

&可用站点/site.conf

<VirtualHost *:80>
ServerName site
DocumentRoot /var/www/site/public
<Directory /var/www/site/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/site-error.log
CustomLog ${APACHE_LOG_DIR}/site-access.log combined
LimitRequestBody 20000000

和sudo服务apache2重启

但错误仍然存在。

/etc/nginx/nginx.conf

/usr/local/nginx/conf/nginx.conf

不存在

首先运行此命令并找到配置文件路径

nginx -t

然后把这个添加到

client_max_body_size 200M;

(你可以将200更改为你想要的任何数字(
然后重新启动你的nginx

最新更新