52AV手機A片王|52AV.ONE

標題: PHP上傳檔案的限制與修改 [打印本頁]

作者: IT_man    時間: 2015-10-16 17:35
標題: PHP上傳檔案的限制與修改
[1]  vi /etc/php.ini6 ~* v" A" A, T0 N1 h

$ C! t5 X9 b' b- G( w  o  ]5 F" lmax_execution_time = 300     Script執行時間上限(單位:秒)4 ]  {( R! P2 G; I

! W/ S% a# L- e7 y0 V+ emax_input_time = 300   Script處理資料時間上限(單位:秒)# ]  y- `$ ^: T1 }0 ^- @

/ Y) a& v: o& M, n) F6 V- qmemory_limit = 2001M   系統記憶體(注意,這個的值一定要設比下面兩項的值都大)" X$ J* W8 c: A; G3 L( g* ?

% v  ^+ f$ H) n* @0 Ppost_max_size = 200M   使用表單的file欄位時是用POST傳值(最主要2)5 y& D. Y1 T& K( @6 z8 p" n5 L

# }. k- H! @4 iupload_max_filesize = 2000M   單次上傳檔案容量(最主要1)* X2 l5 L8 q3 t

' W+ U! K- u1 `- kdefault_socket_timeout = 300   Socket無回應斷線時間(單位:秒)8 x8 t* p4 w) q0 R, t  R, {

) g4 |8 f& g$ {4 ^. P$ j[2]  vi /etc/nginx/nginx.conf
+ q  q- \3 M7 z7 j- I, I$ i* P- p0 @. O3 C2 X# N7 J
client_max_body_size 2500M;client_body_buffer_size 2500M;4 W, q& ]9 q3 y* L/ h
3 G, w. o7 H  W
[3]  更改 /etc/nginx/conf.d/ 欲加大上傳檔案之網站的設定檔  , Ex: av4u.info.conf
: |0 S" M8 u2 gclient_max_body_size 2500m;( s8 z' V8 F1 O3 ^; P8 C
client_body_buffer_size 2500m;
$ L$ u5 U8 f8 K7 w) w

5 j6 @8 `) ^) K: _  F8 U
9 f. A: e. \8 k% k! F
[4] vi /etc/php-fpm.d/www.conf& ?' E4 {) m* y$ I4 R( ~9 ~; C
request_terminate_timeout  = 0   (default value = 0) 重要
5 o) T) Q4 r8 h1 m# r
以前的經驗設為60s , 當上傳 5G 以上的大小上傳完成再經過60s後就出現 "502 bad gateway",經查 /var/log/nginx/下的相關 error log 發現:; @8 T4 d0 q% B; u
*1138927 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xxx.xxx.xxx.xxx , 後省略
( m: \5 ^; j4 H/ _4 B3 B* j; a3 N6 @- `9 ~- `
[5]- H8 D0 M/ O7 s, e" E
service php-fpm restart
9 Y2 G- P$ G8 K% q; dservice nginx restart2 \! q" W& e) d' {

0 A1 g# K7 p) E1 [
& f* q6 e" d6 s7 ?# r  E3 {2 D( v: p6 w
* \# L2 L- E+ A. C( t* K# ~
4 d# s$ U2 h2 n0 @
8 _/ M/ K$ e/ t/ U: G' h
, A& m! p  l7 d( A) L5 U





歡迎光臨 52AV手機A片王|52AV.ONE (https://www.itech.casa/) Powered by Discuz! X3.2