如何更新和添加模块nginx debian

如何更新nginx添加模块,而不删除旧的nginx文件/configuration?

我安装了apt-get安装nginx,我试图通过从nginx网站下载tar.gz安装,但它没有任何效果。

我正在使用debian 6.0.2压缩

我会很感激的build议。

最好的祝福

如果你想要新的模块,你将不得不重新编译你的nginx。 如果你想从源代码安装,你必须先删除Debian软件包。 这里有一个简短的教程。 我正在以root用户身份执行以下操作:

创build您的configuration文件的备份:

mkdir ~/nginx-config-backup && cp -r /etc/nginx/* ~/nginx-config-backup 

删除以前的nginx安装:

 apt-get remove nginx* 

你需要这个从源代码构buildnginx:

 apt-get install build-essentials 

我们将放置源文件的目录:

 cd /usr/local/src 

获取最新的nginx开发版本:

 wget http://nginx.org/download/nginx-1.3.9.tar.gz tar -zxvf nginx-1.3.9.tar.gz mv nginx-1.3.9 nginx rm -f nginx-1.3.9.tar.gz 

获取最新的PCRE版本:

 cd ../../lib wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz tar -zxvf pcre-8.31.tar.gz mv pcre-8.31 pcre rm -f pcre-8.31.tar.gz 

获取最新的OpenSSL版本:

 wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz tar -zxvf openssl-1.0.1c.tar.gz mv openssl-1.0.1c openssl rm -f openssl-1.0.1c.tar.gz 

获取最新的zlib版本:

 git clone git://github.com/madler/zlib.git 

现在我为nginx下载两个示例模块:

 cd ../includes git clone git://github.com/masterzen/nginx-upload-progress-module.git git clone git://github.com/gnosek/nginx-upstream-fair.git 

回到nginx; 我们configuration我们的安装并编译并安装它:

 cd ../src/nginx ./configure --prefix=/usr/local --sbin-path=/usr/local/sbin --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx --with-debug --with-file-aio --with-http_gzip_static_module --with-http_realip_module --with-http_ssl_module --with-md5=/usr/local/lib/openssl --with-md5-asm --with-openssl=/usr/local/lib/openssl --with-sha1=/usr/local/lib/openssl --with-sha1-asm --with-pcre=/usr/local/lib/pcre --with-pcre-jit --with-zlib=/usr/local/lib/zlib --without-http_browser_module --without-http_geo_module --without-http_limit_req_module --without-http_limit_conn_module --without-http_memcached_module --without-http_referer_module --without-http_split_clients_module --without-http_ssi_module --without-http_upstream_ip_hash_module --without-http_userid_module --without-http_uwsgi_module --add-module=/usr/local/include/nginx-upload-progress-module --add-module=/usr/local/include/nginx-upstream-fair make make install 

不要忘记清理一切:

 cd /usr/local rm -rf src/nginx include/nginx-upload-progress-module include/nginx-upstream-fair lib/pcre lib/zlib lib/openssl 

您现在将在/usr/sbin/nginx有一个可用的nginx二进制文件。 还要确保为nginx更新你的init -script(在/etc/init.d/nginx )。 以下是我的个人init脚本:

https://github.com/Fleshgrinder/nginx-sysvinit-script