I've been trying to make an Android app which will have the function to create new user profiles and store the various details(email, password, etc.) to a remote server. Now, I'm using JSON to upload the user data to my remote server. But, the problem is, when I'm trying upload a high resolution image to my server for the user's profile picture, it is giving me a "413 Request Enitity Too Large" error. Now, I read online that these kind of errors can be fixed by editing the php.ini
and nginx.conf
, but the problem is, though I managed to change the values in the php.ini
, I can't even find the nginx.conf
file on my server! Even though my server host claims that nginx
is installed on all their servers. What should I do in such a situation? Is there any way to edit the nginx.conf
programmatically using php?
Here's the output I'm getting:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>413 Request Entity Too Large</title>
</head><body>
<h1>Request Entity Too Large</h1>
The requested resource<br />/enter_name.php<br />
does not allow request data with POST requests, or the amount of data provided inthe request exceeds the capacity limit.
</body></html>
Any help on this issue shall be highly appreciated
You can check nginx config with this command:
nginx -t
Config file location will be in result, for example:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Then set client_max_body_size directive in this config:
client_max_body_size 20m;
See nginx docs for details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.