nginx 使用教程

nginx 使用教程

nginx 开启目录列表使用

autoindex on;
autoindex_exact_size off;
charset utf-8,gbk;

参考 ('http://stephen830.iteye.com/blog/2154049')

fancyindex扩展 美化

  1. 下载 nginx

  2. 安装 nginx,添加扩展
    查看原配置 nginx -V, 在原配置基础上添加 ngx-fancyindex 模块
    安装nginx所需环境

sudo apt-get install libxml2 libxml2-dev libxslt-dev
sudo apt-get install libgd2-xpm libgd2-xpm-dev
查看 nginx 当前配置
nginx -V
在当前配置基础上添加 ngx-fancyindex 模块
./configure  --add-module=../ngx-fancyindex 
编译
make
报错
nginx cannot find -lperl

安装 perllib
apt-get install libperl-dev
将编译的 nginx 覆盖原 nginx
sudo mv /usr/sbin/nginx /usr/sbin/nginx-1.1.19
sudo cp objs/nginx /usr/sbin/nginx
最后查看 nginx 模块是否安装成功
```
nginx -V
```
  1. 配置 nginx
    打开 /etc/nginx/nginx.conf,添加如下配置
    fancyindex on;
    fancyindex_exact_size off;
    fancyindex_localtime on;
    fancyindex_default_sort "date_desc";
    fancyindex_header "/fancyindex/header.html";
    fancyindex_footer "/fancyindex/footer.html";
    fancyindex_ignore "fancyindex";
    #autoindex on;
    #autoindex_exact_size off;
    charset utf-8,gbk;

参考文档

  1. http://stephen830.iteye.com/blog/2154049
  2. http://blog.csdn.net/llnara/article/details/9613089
  3. http://www.swiftyper.com/2016/12/08/nginx-autoindex-configuration/
  4. http://www.tennfy.com/2489.html
  5. https://github.com/aperezdc/ngx-fancyindex
  6. https://github.com/TheInsomniac/Nginx-Fancyindex-Theme
  7. http://www.cnblogs.com/terrysun/archive/2012/11/22/2782472.html 如何升级Nginx到最新稳定版
  8. http://jingpin.jikexueyuan.com/article/48920.html apt-get 方式安装nginx后,增加模块--with-http_perl_module
  9. http://www.cnblogs.com/gaohj/p/7019712.html 实战开发一个Nginx扩展 (Nginx Module)
  10. http://www.cnblogs.com/lixigang/articles/5130052.html 已安装nginx动态添加模块
  11. http://blog.csdn.net/shuzui1985/article/details/7628110 ubuntu 编译 /usr/bin/ld: cannot find 问题解决
原文地址:https://www.cnblogs.com/xunux/p/7270615.html