Ubuntu 9.10安装Nginx 0.8.34和upstream fair

首先,为了编译 Nginx,应在新装好的 Ubuntu server 环境下安装如下软件包:

 sudo apt-get install build-essential libpcre3-dev libssl-dev libxslt-dev libgd2-xpm-dev libgeoip-dev

然后下载 0.8.34 版本的 Nginx:

解压:

 tar xvzf nginx-0.8.34.tar.gz

下载 upstream fair 模块。upstream fair 是比内建的负载均衡更加智能的负载均衡模块。它采用的不是内建负载均衡使用的轮换的均衡算法,而是可以根据页面大小、加载时间长短智能的进行负载均衡。

解压:

 tar xvzf gnosek-nginx-upstream-fair-2131c73.tar.gz

然后进入 nginx 源码目录执行 configure 配置编译选项。下面是我所使用的配置:

 ./configure --conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--with-debug \
--with-http_stub_status_module \
--with-http_flv_module \
--with-http_ssl_module \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-mail \
--with-mail_ssl_module \
--with-ipv6 \
--with-http_realip_module \
--with-http_geoip_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-sha1=/usr/include/openssl \
--with-md5=/usr/include/openssl \
--add-module=/home/mikespook/gnosek-nginx-upstream-fair-2131c73

这个配置来自于 Jeff Waugh 的 PPA 中的 nginx 0.8.34 编译选项。配置、lock、pid 等文件的位置都是按照 ubuntu 系统惯例设置的。需要注意的是 –add-module 指向的是 upstream fair 的解压缩目录的绝对路径。这样就可以将 upstream fair 编译进 nginx。

相关推荐