网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

nginx配置文件下载及在线浏览

nginx 配置文件下载及在线浏览

站在用户的角度思考问题,与客户深入沟通,找到新密网站设计与新密网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站建设、做网站、企业官网、英文网站、手机端网站、网站推广、空间域名、网络空间、企业邮箱。业务覆盖新密地区。

1.主配置文件

# vim nginx.conf
user  nginx;
worker_processes  2;
worker_rlimit_nofile 65535;
error_log  /usr/local/nginx/logs/error.log warn;
pid        /usr/local/nginx/logs/nginx.pid;

events {
    use epoll;
    worker_connections  4096;
    multi_accept on;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

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

    server_tokens off;
    sendfile        on;
    tcp_nopush  on;
    tcp_nodelay on;


    keepalive_timeout  65;
    client_header_timeout 20;
    client_body_timeout 20;
    send_timeout 30;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 4;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;


    include        fastcgi_params;
    include /usr/local/nginx/conf/vhosts/*.conf;
}

2.下载配置文件

# vim toms-file.conf 
server {
    listen 80;
    server_name  10.1.1.222;
    access_log /data/logs/file_seedeer.log main;
    index    index.html index.htm index.php;
    root   /pdf_data/pdf;

    access_log_bypass_if ($remote_addr ~* '^100.97') and;
    access_log_bypass_if ($request ~* "HEAD / HTTP/1.0");
    access_log  /usr/local/nginx/logs/api_toms.log;
    charset utf-8;

    location / {
         autoindex on;  
         autoindex_exact_size on;  
         autoindex_localtime on; 
         if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
            add_header Content-Disposition: 'p_w_upload;';
         }
    }
    

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|mp3)$ {
        expires      30d;
    }
 
    location ~ .*\.(js|css)?$ {
        expires      30d;
    }
}

3.说明

location / {
         autoindex on;  
         autoindex_exact_size on;  
         autoindex_localtime on; 
         if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
            add_header Content-Disposition: 'p_w_upload;';
         }
    }

 以上配置允许的文件格式后缀,文件可以打开,可以下载。

charset utf-8; //支持的字符集,不然汉字会乱码

4.测试文件预览及下载

nginx 配置文件下载及在线浏览

nginx 配置文件下载及在线浏览


标题名称:nginx配置文件下载及在线浏览
当前链接:http://bjjierui.cn/article/ijcehd.html

其他资讯