当前位置: 首页 > news >正文

Nginx解决文件服务器文件名显示不全的问题

Nginx可以搭建Http文件服务器,但默认的搭建会长文件名显示不全,比如如下:

问题:显示不全,出现...,需要进行解决
在这里插入图片描述
这里使用重新编绎nginx的方式,见此文:
https://unix.stackexchange.com/questions/145587/nginx-long-filenames-in-directory-listing

http://forum.nginx.org/read.php?2,124400,167420#msg-167420
January 18, 2011 08:36PM
fagtron
I looked all over the net and wasn't able to find this answer anyway, 
so I looked into the nginx source files and it's very easy.Simply modify the file located at [b]src/http/modules/ngx_http_autoindex_module.c[/b] and then compile.Change these lines:[b]#define NGX_HTTP_AUTOINDEX_PREALLOCATE 50#define NGX_HTTP_AUTOINDEX_NAME_LEN 50[/b]to whatever you want, such as:[b]#define NGX_HTTP_AUTOINDEX_PREALLOCATE 100#define NGX_HTTP_AUTOINDEX_NAME_LEN 100[/b]And then compile and restart nginx. That's it !!!

1.下载最新nginx-1.24.0.tar.gz,并修改源码

将源码src/http/modules/ngx_http_autoindex_module.c

#define NGX_HTTP_AUTOINDEX_PREALLOCATE 50
#define NGX_HTTP_AUTOINDEX_NAME_LEN 50

修改为

#define NGX_HTTP_AUTOINDEX_PREALLOCATE 100
#define NGX_HTTP_AUTOINDEX_NAME_LEN 100

2.重新编绎安装

cd /usr/local/nginx-1.24.0/
./configure --prefix=/usr/local/nginx  --with-stream --with-http_ssl_module --with-stream_ssl_preread_module --with-stream_ssl_module
make
make install

源码安装可以参见Centos7源码安装Nginx1.20及直接二进制迁移部署

3.重新测试,问题解决

在这里插入图片描述

http://www.lryc.cn/news/104790.html

相关文章:

  • IO进程线程第四天(8.1)
  • WAF绕过-权限控制篇-后门免杀
  • LED灯的驱动,GPIO子系统,添加按键的中断处理
  • Gradle和Maven的区别
  • C#中 使用yield return 优化大数组或集合的访问
  • ROS实现导航中止(pub命令版+C++代码版)
  • 【VTK】读取一个 STL 文件,并使用 Qt 显示出来,在 Windows 上使用 Visual Studio 配合 Qt 构建 VTK
  • 数据结构--基础知识
  • 天工开物 #7 Rust 与 Java 程序的异步接口互操作
  • python实现视频转GIF动图(无水印,包含代码详解和.exe执行文件)
  • 一套AI+医疗模式的医院智慧导诊系统源码:springboot+redis+mybatis plus+mysql
  • Android 使用modbus协议与可能遇到的问题解决一览
  • Virtualbox虚拟机中Ubuntu忘记密码
  • isPresent()
  • DC.js教程_编程入门自学教程_菜鸟教程-免费教程分享
  • Qt应用开发(基础篇)——滑块类 Slider、ScrollBar、Dial
  • iOS的NSUserActivity
  • Android HTTP使用(详细版)
  • 【雕爷学编程】MicroPython动手做(25)——语音合成与语音识别
  • 前端开发:基于cypress的自动化实践
  • C++类和对象(下部曲)
  • 解决eclipse 打开报错 An error has occurred. See the log file null.
  • javascript学习
  • 基于SSM实现个人随笔分享平台:创作心灵,分享自我
  • 从零开始学Docker(二):启动第一个Docker容器
  • unity 鼠标事件
  • 【ChatGPT】相关解读
  • 【数据中台】DataX源码进行二开插件
  • 【数据结构与算法】基数排序
  • Java基础一(队列和堆栈)