一、安装必要的软件包,以保证nginx和keepalived能安装:
yum -y install gcc gcc-c++ make
yum -y install wget #安装下载工具
yum -y install pcre-devel #安装nginx的依赖软件包
yum -y install openssl-devel #安装keepalived依赖软件包
yum -y install popt-devel #安装keepalived依赖软件包
rpm -ivh keepalived-1.2.13-5.el6_6.x86_64.rpm
nginx安装软件
rpm -ivh pcre-devel-7.8-7.el6.x86_64.rpm
rpm -ivh openssl-devel-1.0.1e-42.el6.x86_64.rpm krb5-devel-1.10.3-42.el6.x86_64.rpm zlib-devel-1.2.3-29.el6.x86_64.rpm keyutils-libs-devel-1.4-5.el6.x86_64.rpm libcom_err-devel-1.41.12-22.el6.x86_64.rpm libselinux-devel-2.0.94-5.8.el6.x86_64.rpm libsepol-devel-2.0.41-4.el6.x86_64.rpm
rpm -ivh popt-devel-1.13-7.el6.x86_64.rpm
useradd www -s /sbin/nologin -M
chown -R wwww:www /usr/local/nginx
mkdir -p /var/log/nginx
mkdir -p /var/tmp/nginx
patch -p1 < /tmp/nginx_upstream_check_module-master/check_1.7.5+.patch
./configure \
--user=www \
--group=www \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--pid-path=/var/run/nginx.pid \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client_body_temp \
--http-proxy-temp-path=/var/tmp/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/tmp/nginx/scgi_temp \
--add-module=/tmp/nginx_upstream_check_module-master
--add-module=/root/scripts/src/nginx_upstream_jvm_route/
nginx_upstream_check_module
chown -R www:www /usr/local/nginx
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install #编译,--with-http_stub_status_module --with-http_ssl_module这两个模块必须开启
编写nginx启动脚本
./configure --add-module=../modules/echo-nginx-module-0.57 --add-module=../modules/ngx_http_redis-0.3.7 --add-module=../modules/ngx_devel_kit-0.2.19 --add-module=../modules/set-misc-nginx-module-0.29 --add-module=../modules/srcache-nginx-module-master --add-module=../modules/redis2-nginx-module-master