WordPress upload errors and other issues

1. Nginx prompt for uploading files (413 Request Entity Too Large)

After installing WordPress, you can install your favorite theme. When using the upload function, Nginx:413 Request Entity Too Largean error occurs.
After checking, it was found that the default upload file size of Nginx is 1M, which can be modified in Nginx settings.

Solution

Open the Nginx configuration file nginx.conf. The default path is generally /etc/nginx/nginx.conf. If you cannot find this file, you can use the command to find it:

find / -name nginx.conf

HTTP{ }Add to paragraph

client_max_body_size 20m; 

20mThe maximum upload size allowed.
Note, don’t forget the last;
save Changes.
Restart Nginx

systemctl reload nginx

problem solved.

2. PHP prompt for uploading files (the uploaded file size exceeds the upload_max_filesize value defined in php.ini)

When using WordPress, “上传的文件尺寸超过php.ini中定义的upload_max_filesize值。”the reason for the problem when uploading files is that php.inithe file limits the maximum upload file size.

Solution

Open the PHP configuration file php.ini. The default path is generally /etc/php.ini. If you cannot find this file, you can use the command to find it.

find / -name php.ini

To find the location of upload_max_filesizeand post_max_size, you can use

/upload_max_filesize
/post_max_size

look up(This command is a method to query fields in non-editing mode after using vi/vim to open the file), change the value to 20M, and save the changes.
Restart service

service php-fpm restart

If it prompts that the directory cannot be created, you can enter the following content:

chown -Rf  apache:root /usr/share/nginx/html/

problem solved

Picture sharing

Insert image description here

Guess you like

Origin blog.csdn.net/Jo_Francis/article/details/125058449