例子

server {
        listen       81;

        root /var/www/applog;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;

        location / {
    }
    location ~ .*/188.188.1.*/.*\.log$ {
            add_header Content-Type text/plain;
    }
}

查看博文:nginx配置让任何文件在浏览器中显示文本text/plain