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

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

作者: IT_man    時間: 2015-10-16 17:35
標題: PHP上傳檔案的限制與修改
[1]  vi /etc/php.ini0 {) g3 w, H4 U! F$ Y5 Z; n: o

& X9 K9 r5 J4 F  h4 Q+ [max_execution_time = 300     Script執行時間上限(單位:秒)2 a1 i+ t- @& g9 w) c9 y
( `! m$ Q: e0 K
max_input_time = 300   Script處理資料時間上限(單位:秒)4 Z1 p: D$ \$ E& l
* |) _' G# w' G2 i
memory_limit = 2001M   系統記憶體(注意,這個的值一定要設比下面兩項的值都大)
% d6 A$ U5 u/ e! z/ |& h
8 t) p# l& x  g+ A/ _0 Z: Qpost_max_size = 200M   使用表單的file欄位時是用POST傳值(最主要2)
* E1 B( b3 O  B- O/ A6 J! U

$ T' s9 b' @* v- s: Dupload_max_filesize = 2000M   單次上傳檔案容量(最主要1)
9 t+ z( v5 `8 R6 d# y2 C
- c9 i% R# h1 @( m/ bdefault_socket_timeout = 300   Socket無回應斷線時間(單位:秒)
8 g' m4 b) q- m; k' t/ w5 P, k7 X6 B: ]% e' H6 J' }8 U% B8 L
[2]  vi /etc/nginx/nginx.conf
, q* @+ ]0 j  j* Y8 d: f* i4 V( _& k3 I* ]) |; C4 l& i
client_max_body_size 2500M;client_body_buffer_size 2500M;
! L' C% f& K# r6 m" r# M; B0 r  o8 k
[3]  更改 /etc/nginx/conf.d/ 欲加大上傳檔案之網站的設定檔  , Ex: av4u.info.conf
2 g" c; R7 N. K' d2 ~client_max_body_size 2500m;1 S) O# d* y, \2 N5 Q2 N
client_body_buffer_size 2500m;0 l9 h( |& c& }) i$ W/ P, T
+ F+ b  R: ?$ W, a+ d, r

4 ~+ \2 O1 Q1 X6 P9 t. ~
[4] vi /etc/php-fpm.d/www.conf, ^' r% M% P* [, l  o  B; u
request_terminate_timeout  = 0   (default value = 0) 重要- M& t+ b& F+ g; y1 e+ y, `
以前的經驗設為60s , 當上傳 5G 以上的大小上傳完成再經過60s後就出現 "502 bad gateway",經查 /var/log/nginx/下的相關 error log 發現:7 n' B6 ~1 J2 [  E
*1138927 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xxx.xxx.xxx.xxx , 後省略: B0 |) X- {  H1 Z" n- P

. x  {6 S# r- w; i[5]
, [9 g: e4 i4 Z; ~' |4 A6 F5 `/ pservice php-fpm restart
" g1 s" F. s& Y0 oservice nginx restart0 c- v' w3 R4 r- M8 T

8 ~5 ^$ _2 R* _& V& R- F
. N6 g, q" `2 k9 U/ c- E9 ]
4 K( J) H& A5 W1 e" W
6 V9 V$ d7 S! s: i3 V; E. z! O! z6 Y

( X, U+ Z  ]4 c
( a! W% A% f& h. E




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