全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 1045|回复: 1
打印 上一主题 下一主题

apt-get方式安装nginx后,重新编译增加fancyindex模块

[复制链接]
跳转到指定楼层
1#
发表于 2016-3-12 12:08:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
为保险起见下载和apt-get安装的一样的版本

一、查看nginx版本

nginx -v
nginx: nginx version: nginx/1.2.1

二、查看apt-get安装的编译参数

nginx -V

–prefix=/etc/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-client-body-temp-path=/var/lib/nginx/body –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-log-path=/var/log/nginx/access.log –http-proxy-temp-path=/var/lib/nginx/proxy –http-scgi-temp-path=/var/lib/nginx/scgi –http-uwsgi-temp-path=/var/lib/nginx/uwsgi –lock-path=/var/lock/nginx.lock –pid-path=/var/run/nginx.pid –with-pcre-jit –with-debug –with-http_addition_module –with-http_dav_module –with-http_geoip_module –with-http_gzip_static_module –with-http_image_filter_module –with-http_realip_module –with-http_stub_status_module –with-http_ssl_module –with-http_sub_module –with-http_xslt_module –with-ipv6 –with-sha1=/usr/include/openssl –with-md5=/usr/include/openssl –with-mail –with-mail_ssl_module –add-module=/build/nginx-1.2.1/debian/modules/nginx-auth-pam –add-module=/build/nginx-1.2.1/debian/modules/nginx-echo –add-module=/build/nginx-1.2.1/debian/modules/nginx-upstream-fair –add-module=/build/nginx-1.2.1/debian/modules/nginx-dav-ext-module

其实后面几个add_module 参数如果不需要,可以去掉的

三、下载相同版本的源码包

wget http://www.nginx.org/download/nginx-1.2.1.tar.gz
tar zxf nginx-1.2.1.tar.gz
cd nginx-1.2.1

把刚才的configure参数放进来并增加新的fancyindex

./configure –prefix=/etc/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-client-body-temp-path=/var/lib/nginx/body –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-log-path=/var/log/nginx/access.log –http-proxy-temp-path=/var/lib/nginx/proxy –http-scgi-temp-path=/var/lib/nginx/scgi –http-uwsgi-temp-path=/var/lib/nginx/uwsgi –lock-path=/var/lock/nginx.lock –pid-path=/var/run/nginx.pid –with-pcre-jit –with-debug –with-http_addition_module –with-http_dav_module –with-http_geoip_module –with-http_gzip_static_module –with-http_image_filter_module –with-http_realip_module –with-http_stub_status_module –with-http_ssl_module –with-http_sub_module –with-http_xslt_module –with-ipv6 –with-sha1=/usr/include/openssl –with-md5=/usr/include/openssl –with-mail –with-mail_ssl_module –add-module=./ngx-fancyindex-master

四、编译nginx

make

注意不要make install,make install会覆盖安装

在configure时可能会报一些错误,简列如下

1. rewrite需要pcre支持
./configure: error: the HTTP rewrite module requires the PCRE library.
apt-get install libpcre3 libpcre3-dev

2. http cache需要openssl
./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.
apt-get install libssl-dev openssl

3. 安装libxslt
./configure: error: the HTTP XSLT module requires the libxml2/libxslt libraries.
apt-get install libxslt-dev

4. 缺少GD library
./configure: error: the HTTP image filter module requires the GD library.
apt-get install libgd2-xpm libgd2-xpm-dev

5. 安装GeoIP library
./configure: error: the GeoIP module requires the GeoIP library.
apt-get install libgeoip-dev

make 完成后,这时会在/usr/src/nginx-1.2.1 下生成一个文件夹objs

把nginx二进制文件拷贝sbin下,注意备份原nginx

cp objs/nginx /usr/sbin/nginx

试一下nginx配置文件

/usr/sbin/nginx -t

重启nginx
2#
发表于 2016-3-12 12:10:28 | 只看该作者
1.2.1
这是什么古董
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2026-1-13 20:49 , Processed in 0.056914 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表