2440 发表于 2018-11-16 12:28:43

nginx安装upload和MD5,echo模块

mkdir -p /usr/local/nginx/html/test  
echo testFile >/usr/local/nginx/html/test/testFile
  

  
    server {
  
      listen       80;
  
      server_namelocalhost;
  
      root   html;
  
      location /test {
  
            add_header    Content-MD5    $file_md5;
  
      }
  
/usr/local/nginx/sbin/nginx -s reload
  
这样直接访问
  

  
# curl-I localhost/test/testFile
  
HTTP/1.1 200 OK
  
Server: nginx/1.8.1
  
Date: Tue, 09 Jan 2018 06:15:59 GMT
  
Content-Type: text/plain
  
Content-Length: 9
  
Last-Modified: Tue, 09 Jan 2018 06:15:54 GMT
  
Connection: keep-alive
  
ETag: "5a545e1a-9"
  
Content-MD5: d43a6ecaa892a1962398ac9170ea9bf2
  
Accept-Ranges: bytes
  

  
就能出MD5了
  

  
还有就是直接访问就能出MD5的需要echo
  
http {
  
    server {
  
      listen       80;
  
      server_namelocalhost;
  
      root   html;
  
      location /test {
  
#            add_header    Content-MD5    $file_md5;
  
             if ( $arg_md5 ~* "true" )
  {
  
               echo $file_md5;
  
             }
  
      }
  
}
  
}
  
/usr/local/nginx/sbin/nginx -s reload


页: [1]
查看完整版本: nginx安装upload和MD5,echo模块