![图片[1]-WordPress上传文件大小限制修改 - 轻快博客-轻快博客](https://www.tmcns.cn/wp-content/uploads/2022/11/AE7455C6-299B-4761-8EA8-2DFEF178BED8.png)
WordPress对上传文件的大小会有一定限制,可通过如下方法进行修改:
1、 修改PHP配置文件/etc/php.ini
file_uploads = on ;
upload_max_filesize = 2G ;
post_max_size = 2G ;123123
2、修改 Nginx 配置文件/etc/nginx/nginx.conf
(如果用的是 Nginx 服务器的话),添加
client_max_body_size 2G; # 允许上传 2G11
一个完整的示例如下:
server {
server_name yourdomain.com;
listen 80;
# root /usr/share/nginx/wordpress;
return 301 https://$server_name$request_uri;
}
server {
server_name yourdomain.com; #填写绑定证书的域名
listen 443;
root /usr/share/nginx/wordpress;
ssl on;
ssl_certificate /etc/nginx/cert/server.crt;
ssl_certificate_key /etc/nginx/cert/server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php index.php;
}
location ~ .php$ {
proxy_pass https://127.0.0.1:8080;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
client_max_body_size 5G; # 一定要在这里才有效
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}12345678910111213141516171819202122232425262728293031321234567891011121314151617181920212223242526272829303132
注:如果出现HTTP错误
,还应检查WordPress程序目录下 /wp-content/uploads
目录的权限。
© 版权声明
THE END
暂无评论内容