发表于 2018-11-9 10:15:57

利用nginx下载服务器本地的文件

# cat nginx.conf  
# For moreinformation on configuration, see:
  
#   * Official English Documentation:http://nginx.org/en/docs/
  
#   * Official Russian Documentation:http://nginx.org/ru/docs/
  

  
user nginx;
  
worker_processesauto;
  
error_log/var/log/nginx/error.log;
  
pid/run/nginx.pid;
  

  
# Load dynamicmodules. See /usr/share/nginx/README.dynamic.
  
include/usr/share/nginx/modules/*.conf;
  

  
events {
  
    worker_connections 1024;
  
}
  

  
http {
  
    log_format main'$remote_addr - $remote_user[$time_local] "$request" '
  
                      '$status $body_bytes_sent"$http_referer" '
  
                     '"$http_user_agent" "$http_x_forwarded_for"';
  

  
    access_log /var/log/nginx/access.logmain;
  

  
    sendfile            on;
  
    tcp_nopush          on;
  
    tcp_nodelay         on;
  
    keepalive_timeout   65;
  
    types_hash_max_size 2048;
  

  
    include             /etc/nginx/mime.types;
  
    default_type      application/octet-stream;
  

  
    # Load modular configuration files from the/etc/nginx/conf.d directory.
  
    # Seehttp://nginx.org/en/docs/ngx_core_module.html#include
  
    # for more information.
  
    include /etc/nginx/conf.d/*.conf;
  

  
    server {
  
      listen       80 default_server;
  
      root         /usr/share/nginx/html;
  

  
      # Loadconfiguration files for the default server block.
  
      include/etc/nginx/default.d/*.conf;
  

  
      location /{
  
      indexindex.html index.htm;
  
      autoindexon;       #开启nginx目录浏览功能
  
       autoindex_exact_size off;   #文件大小从KB开始显示
  
                        #默认为on,显示出文件的确切大小,单位是bytes。
  
                         #改为off后,显示出文件的大概大小,单位是kB或者MB或者GB
  
       autoindex_localtime on;   #显示文件修改时间为服务器本地时间
  
      charsetutf-8,gbk;          #显示中文
  
   #limit_conn one 8;      #并发数
  
      limit_rate100k;         #单个线程最大下载速度,单位KB/s      }
  

  
      error_page 404 /404.html;
  
            location = /40x.html {
  
      }
  

  
      error_page 500 502 503 504 /50x.html;
  
            location = /50x.html {
  
      }
  
    }
  
    }
  
}


页: [1]
查看完整版本: 利用nginx下载服务器本地的文件