nginx 升级、问题解决、模块添加
1 去http://nginx.org/下载最新版本,解压(安装有些模块需要确定的版本),我安装的版本nginx-1.2.8
2 察看当前版本
levi@levi-desktop:~/nginx-1.2.8$ nginx -V
nginx version: nginx/1.2.8
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
TLS SNI support enabled
configure arguments: --prefix=/usr/sbin/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-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-cc-opt=-Wno-error --with-mail_ssl_module --add-module=/tmp/nginx-gridfs/ --add-module=/tmp/nginx_upload_module-2.2.0/
3 编译新版本
(1)$cd /to/path/nginx-*
(2)$./configure --prefix=/usr/sbin/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-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-cc-opt=-Wno-error --with-mail_ssl_module --add-module=/tmp/nginx-gridfs/ --add-module=/tmp/nginx_upload_module-2.2.0/
(--add-module 编译时添加模块,可以不添加模块)
(3)$make
4 备份旧版本的nginx可执行文件,复制新版本的nginx这行文件(一般在/usr/sbin/)
$sudo mv /usr/sbin/nginx/usr/sbin/nginx.old
1. pcre
./configure: error: the HTTP rewrite module requires the PCRE library.
使用:
sudo apt-get install libpcre3 libpcre3-dev
2. openssl
./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.
sudo apt-get install libssl-dev openssl
3. libxslt
./configure: error: the HTTP XSLT module requires the libxml2/libxslt libraries.
sudo apt-get install libxslt-dev
4. GD library
./configure: error: the HTTP image filter module requires the GD library.
sudo apt-get install libgd2-xpm libgd2-xpm-dev
5. GeoIP library
./configure: error: the GeoIP module requires the GeoIP library.
sudo apt-get install libgeoip-dev

浙公网安备 33010602011771号