업로드 모듈 의 nginx 컴 파일 과 설정 을 추가 합 니 다.
sudo apt-get install nginx 명령 하나 로 해결 할 수 있 습 니 다.그러나 업로드 모듈 을 사용 하려 면 다시 컴 파일 해 야 합 니 다. 이것 은 apt - get 으로 설 치 된 nginx 를 사용 하려 면 설정 파일 을 포함 하여 마 운 트 해제 해 야 한 다 는 것 을 의미 합 니 다. sudo apt-get autoremove --purge nginx 그리고 nginx 업로드 에 필요 한 모듈 을 다운로드 해 야 합 니 다.소스 코드 다운로드
1. 업로드 모듈 과 업로드 진행 모듈 다운로드
cd
mkdir tmp && cd tmp
git clone -b 2.2 https://github.com/vkholodkov/nginx-upload-module.git
git clone https://github.com/masterzen/nginx-upload-progress-module.git
  2. nginx 의 원본 코드 다운로드: 주의: 최신 1.12.0 을 사용 하면 오류 (md5 오류, 해결 되 지 않 음) 가 발생 할 수 있 습 니 다. 1.10. x 를 사용 하면 됩 니 다.
http://nginx.org/en/download.html
  위 에 있 는 사이트 에 직접 올 라 가서 다운로드 한 후에 스트레스 를 풀다.
설치 의존 도:
sudo apt-get install libpcre3 libpcre3-dev 
  이 가능 하 다, ~ 할 수 있다,...
sudo apt-get install openssl libssl-dev
  컴 파일 시작:
압축 을 푸 는 nginx 디 렉 터 리 에 들 어 갑 니 다.
sudo ./configure  --add-module=/home/xxx/tmp/nginx-upload-module --add-module=/home/xxx/tmp/nginx-upload-progress-module
  여기에 두 개의 모듈 이 추가 되 었 습 니 다. 자신 이 다운로드 한 두 개의 모듈 주소 에 대응 하 십시오.
sudo make 
make install
  컴 파일 에 주의 하 십시오. 마지막 으로:
포장 가능: (무시 가능)
sudo apt-get install checkinstall #      
sudo checkinstall -D -y -install=no -default make install
  dpkg 로 설치:
sudo dpkg -i nginx_1.4.6-1_amd64.deb
  dpkg 설치 시 이 문제 가 발생 할 수 있 습 니 다.
dpkg: error processing archive nginx_1.4.6-1_amd64.deb (--install):
 trying to overwrite '/etc/nginx/win-utf', which is also in package nginx-common 1.10.0-0ubuntu0.16.04.4
Errors were encountered while processing:
 nginx_1.4.6-1_amd64.deb
  이렇게 하면 설치 할 때 매개 변 수 를 추가 하면 됩 니 다. 이 방법 은 이전의 nginx 를 덮어 씁 니 다.
sudo dpkg -i --force-overwrite nginx_1.4.6-1_amd64.deb
  수정 nginx
nginx 를 설정 하기 전에: 다른 서버 / etc / init. d / nginx 파일 을 복사 해 야 합 니 다. 컴 파일 된 nginx 는 service 시작 에 추가 되 지 않 았 기 때문에 귀 찮 습 니 다. 시험 을 본 후에 고 쳐 야 할 부분 은:
PATH 마지막 에 / usr / local / nginx / sbin 추가:
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/nginx/sbin: DAEMON 수정: DAEMON=/usr/local/nginx/sbin/nginx NGINXCONF_FILE 수정 NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"nginx 권한 수정:sudo chmod 755 /etc/init.d/nginx
  이제 nginx 를 다시 시작 할 수 있 습 니 다.
sudo /etc/init.d/nginx -s reload
  nginx 파일 설정:
여기 참조 하 셔 도 됩 니 다.https://hui.lu/upload-file-with-nginx-upload-file/
 location /upload {
 65             upload_pass @test; #          ,          /upload    
 66             upload_resumable on;
 67             upload_cleanup 400 413 404 499 500-505;
 68             upload_store /tmp 1;
 69             upload_store_access user:rw all:rw;
 70         #     upload_limit_rate 0;
 71             upload_set_form_field "file_name" $upload_file_name;
 72             upload_set_form_field "content_type" $upload_content_type;
 73             upload_set_form_field "tmp_path" $upload_tmp_path;
 74             upload_aggregate_form_field "md5" $upload_file_md5;
 75             upload_aggregate_form_field "size" $upload_file_size;
 76             upload_pass_form_field "^.*$";
 77         #     upload_pass_args on; #    ,                   
 78         #     track_uploads proxied 30s; #        
 79         }
 80         location @test {                                                                                   
 81             proxy_pass http://localhost:8080;
 82         }
    upload module      
upload_pass
             ,             。
upload_resumble
      ,    
upload_store
         ,       hash     ,  nginx         ,       ,     
upload_state_store
             ,     ,    hash        ,      .state,       ,          
upload_store_access
nginx user          ,          
upload_set_form_field
             ,            。
$upload_field_name:          input    name  
$upload_content_type:    
$upload_file_name:   
$upload_tmp_path:       
upload_aggregate_form_field
 upload_set_form_field    ,                ,        。
$upload_file_md5:   md5sum 
$upload_file_md5_uc:       md5sum 
$upload_file_sha1:   sha1 sum 
$upload_file_sha1_uc:       sha1 sum 
$upload_file_crc32:16   CRC32     
$upload_file_size:    ,   bytes
$upload_file_number:           
upload_pass_form_field
              ,       
upload_cleanup
            ,nginx        ,      400~500  
upload_max_part_header_len
     http   , buffer size
upload_max_file_size
             ,       “ ”  ,              , client_max_body_size “ ”  。          。
upload_limit_rate
         ,0     
upload_max_output_body_len
       body  ,   file        memory,0     
upload_tame_array
             
    
        :/nginx-upload,             
       ,nginx         ,        location upload,        /nginx-upload,      rewrite           。
               ,        name,content_type, path, md5, size, submit  description
  파일 을 업로드 할 때 action = "/ upload? X - Progress - ID = FmN6gTEshAHccUvR" 중 X - Progress - ID 는 유일한 id 여야 합 니 다. 업로드 할 때 진 도 를 가 져 오 는 id 가 업로드 진 도 를 가 져 오 려 면 / procgress 에 get 요청 / proccess 를 보 내야 합 니까? X - Progress - ID = FmN6gTEshAHccUvR 을 사용 하면 위 에서 전 달 된 진 도 를 얻 을 수 있 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.