RedHat 6.5 企业级下安装nginx,做负载均衡,redhatnginx
RedHat 6.5 企业级下安装nginx,做负载均衡,redhatnginx
平台为:rhel 6.5 64bit一、安装Nginx:
1、解决基本的工具和相关的包
yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
lib-devel openssl openssl-devel pcre-devel 这几个依赖包都是直接编译安装的make && make install ,但是前提必须安装g++。自己用rpm 来检查。。。。
提示:安装pcre出现问题查看一下连接
pcre 库的安装http://chenzhou123520.iteye.com/blog/1817563
pcre 出错问题解决http://www.2cto.com/os/201304/199770.html
首先添加用户nginx,实现以之运行nginx服务进程:
# groupadd -r nginx
# useradd -r -g nginx nginx
接着开始编译和安装:
# ./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre
# make && make install
3、善后
根据上面的路径在自己的机子上创建相关的目录,注意nginx.conf 和启动nginx的路径。安装这个目录下nginx的欢迎界面在/usr/html 下。
有时还需要创建个:/var/tmp/nginx/client 文件夹
总结:这是自己做nginx负载均衡时查资料的一些积累,写在这里方便以后查看。在这里也谢谢马哥教育的给力支持。。。
评论暂时关闭