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

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

作者: IT_man    時間: 2015-10-16 17:35
標題: PHP上傳檔案的限制與修改
[1]  vi /etc/php.ini) r6 m% M/ ^) U
2 R" J5 J( T8 y
max_execution_time = 300     Script執行時間上限(單位:秒)% n# n- i, ^* B) i% c; ?

# s* E1 i/ E! u7 x, }max_input_time = 300   Script處理資料時間上限(單位:秒)6 w9 g9 g: K# ?! r' y% J$ p$ ^4 T

! C; A$ Y, K4 |' D: _$ g/ Bmemory_limit = 2001M   系統記憶體(注意,這個的值一定要設比下面兩項的值都大)
$ `! x/ e1 I! W' j+ q  w
7 E9 c  M6 V: O. G$ vpost_max_size = 200M   使用表單的file欄位時是用POST傳值(最主要2)
% n, @; ~2 K4 G2 ?+ }* R& a$ g6 z& h

: ]3 x% E' m$ M. }7 supload_max_filesize = 2000M   單次上傳檔案容量(最主要1)
8 ]. B, @# l6 ?( _, q
' C7 L+ V* @8 T2 I' Fdefault_socket_timeout = 300   Socket無回應斷線時間(單位:秒)3 \$ [3 X1 v. V

( N7 T+ h/ }* x* z* h" F[2]  vi /etc/nginx/nginx.conf3 V9 Y$ j$ j0 l  p7 g
. L5 b$ ]) R1 J0 R
client_max_body_size 2500M;client_body_buffer_size 2500M;. @  }4 i2 L: U9 l+ ~! T! X7 Q" p

& l% W6 |) k7 Q6 `2 b0 ^. \[3]  更改 /etc/nginx/conf.d/ 欲加大上傳檔案之網站的設定檔  , Ex: av4u.info.conf
: N2 |# f9 ]& B$ \" j3 v" V  w8 jclient_max_body_size 2500m;
3 ?& R4 n  l/ f/ T5 @6 e, Y. @+ g6 k5 bclient_body_buffer_size 2500m;
% T) w7 l, }& w" {8 y" }' x
2 W! V( e- Z; d* N" \- j
2 U$ ?: }0 u3 c9 g
[4] vi /etc/php-fpm.d/www.conf. b- ]" h4 R' g6 H! D! X
request_terminate_timeout  = 0   (default value = 0) 重要
6 G& m% S9 Y- C
以前的經驗設為60s , 當上傳 5G 以上的大小上傳完成再經過60s後就出現 "502 bad gateway",經查 /var/log/nginx/下的相關 error log 發現:
1 o9 f. k0 a, g8 G*1138927 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xxx.xxx.xxx.xxx , 後省略: ^! _6 P1 p. f* Q: ?% y' y1 _; z

' \7 c# t3 [5 j" ]" l7 l[5]
" R7 p5 f% s: W" ]0 @3 hservice php-fpm restart2 ~4 [- s- e9 G, f7 q% Z8 h! h( ^' G! ?
service nginx restart  x/ o6 Q( y: |8 l

- Y$ t& [7 {9 K# n
; |# C9 r$ Q( h- S2 H
1 G) S$ W& Z1 W. s( Z
& j4 J5 W) _0 ^$ C% e. h& @: r9 T; m! C8 _
# S) J9 ^. e7 m6 ]7 G

* ~5 [- B. J1 V& i+ y/ R




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