如何修改MOODLE上传文件大小的限制

https://blog.csdn.net/sflsgfs/article/details/6363172

 

写一个php.php文件,内容为<?php  phpinfo(); ?>  查看可以得到php.ini位置。

sudo vim /etc/php/7.2/fpm/php.ini

 

好吧,发现网站管理--服务器--php信息就可以查看了、

 

一般来说,Moodle 系统中有四种级别的文件限制
- system level (php.ini)   
- moodle level (admin->Config ->Site variables->maxbytes) 
- course level (Course settings->Max Upload size)   
- activity level     

 

修改文件大小的限制
假设你需要把文件的限制改为 12MB , 可以在php.ini 中修改以下的参数

upload_max_filesize = 20M ;   (默认是2M )      限制大小
max_execution_time = 300 ; ( 默认是 30 [seconds] )  超时
post_max_size = 12M ;        ( 默认是 8M )   能接受的文件大小

 

[root@dev-huanqiu ~]# cat /Data/app/nginx/conf/nginx.conf
.......
.......
http {
    include       mime.types;
    default_type  application/octet-stream;
    charset utf-8;   
 
    #######
    ## http setting
    #######
    sendfile       on;
    tcp_nopush     on;
    tcp_nodelay    on;
    keepalive_timeout  100;           #这个参数表示http连接超时时间,默认是65s。要是上传文件比较大,在规定时间内没有上传完成,就会自动断开连接!所以适当调大这个时间。         
    fastcgi_connect_timeout 6000;
    fastcgi_send_timeout 6000;
    fastcgi_read_timeout 6000;
    fastcgi_buffer_size 256k;
    fastcgi_buffers 8 256k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    ##
    client_header_timeout 120s;        #调大点
    client_body_timeout 120s;          #调大点
    client_max_body_size 100m;         #主要是这个参数,限制了上传文件大大小
    client_body_buffer_size 256k;   
 
    ## support more than 15 test environments
    server_names_hash_max_size 512;
    server_names_hash_bucket_size 128;
 
    gzip  on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 9;
    gzip_types       text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php;
    gzip_vary on;
 
 
 
[root@dev-huanqiu ~]#  cat /Data/app/nginx/conf/vhosts/admin.wangshibo.conf
server {
        listen       80;
 
        server_name  admin.wangshibo.com;
 
 
        #if ($http_x_forwarded_for !~ ^(14.165.97.54|123.110.186.128|123.110.186.68)) {
        #   rewrite ^.*$  /maintence.php last;
        #}
 
        access_log  /var/log/wangshibo.log  main;
 
 
       location   / {
          proxy_pass http://127.0.0.1:8484/;
          proxy_connect_timeout   300;         #这三个超时时间适量调大点      
          proxy_send_timeout      600;        
          proxy_read_timeout      600;
          proxy_set_header X-Real-IP $remote_addr;    # 获取客户端真实IP
          proxy_set_header REMOTE-HOST $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;   # 获取代理者的真实ip
          proxy_set_header X-Forwarded-Scheme  $scheme;    # 解决getScheme,isSecure,sendRedirect
          proxy_buffer_size       32k;
          proxy_buffers           32 256k;
          proxy_busy_buffers_size 512k;
          proxy_temp_file_write_size 512k;
        }
 
      location   /static/video {
         root  /Data/app/tomcat-7-admin-wls/static/video;
        }
 
    } ##end server

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值