zoukankan      html  css  js  c++  java
  • 配置nginx作为下载站点

    nginx默认情况是不允许列出整个目录浏览下载

    1)autoindex参数详解

    autoindex   on                                          //on开启目录浏览
    autoindex_exact_size	off;			//off显示出文件的大概大小,单位是kB或者MB或者GB;默认为on, 显示出⽂件的确切⼤⼩,单位是bytes。
    autoindex_localtime	on;				//显示的⽂件时间为⽂件的服务器时间。默认为off,显示的⽂件时间为GMT时间。
    charset	utf-8,gbk;					//默认中文目录乱码,添加上解决乱码问题;
    

    2)配置下载站点

    #vim /usr/local/nginx/conf/nginx.conf 
    location /download {
    	root html;
    	autoindex on;
    	autoindex_localtime on;
    	autoindex_exact_size off;
    }
    

    注意

    location /download {
    	root html;
    	用户访问:192.168.1.31/download 对应的nginx站点目录是/usr/local/nginx/html/download;
    location / {
    	root html;
    	用户访问:192.168.1.31 对应访问的nginx站点目录是/usr/local/nginx/html 
    

    3)创建目录和添加文件

    mkdir /usr/local/nginx/html/download/test -pv  
    cp /etc/hosts /usr/local/nginx/html/download 
    nginx -t 
    nginx -s reload 
    

    4)验证

    http://192.168.1.31/download/

    5)配置截图

    5)别名方式

    location /upload {
    	alias /load;
    		autoindex on;
    		autoindex_localtime on;
    		autoindex_exact_size off;
    }
    用户访问:192.168.1.31/upload 对应的nginx站点目录是/load,而不是/load/upload 
    
  • 相关阅读:
    rac启动维护笔记
    cache-fusion笔记
    RAC配置笔记
    记一次异机rman还原后的操作
    索引小结
    DBlink的创建与删除
    小说经典语录
    SQL通配符
    ArrayList集合详解
    Oracle数据库四种数据完整性约束
  • 原文地址:https://www.cnblogs.com/lovelinux199075/p/9052277.html
Copyright © 2011-2022 走看看