centos6.5安装nginx

最近经常用到nginx的正向代理,反向代理,对于不怎么熟练配置文件,使用起来是一件很头疼的事,这几天简单的学习一下 ,先分享一下安装(亲测可行)。

除了默认的有时需要这些模块(需要安装openssl openssl-devel gcc gcc-c++ make libtool)

  1. pcre (为了重写rewrite)

# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz

  1. zlib (为了gzip压缩)

# wget http://zlib.net/zlib-1.2.11.tar.gz

  1. openssl (OpenSSL 是一个安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。)

# wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz --no-check-certificate

  1. nginx_upstream_check_module( 检查后端服务器的状态)

# wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/v0.3.0.tar.gz

  1. nginx-goodies-nginx-sticky-module-ng(后端做负载均衡解决session sticky问题)

# wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/08a395c66e42.zip

  1. 下载需要的echo模块

# wget https://github.com/openresty/echo-nginx-module/archive/master.zip

  1. 下载nginx稳定版

# wget http://nginx.org/download/nginx-1.12.0.tar.gz

  1. 命令行输入以下配置(‘=’号后面是自己安装包的绝对路径,和配置文件路径)

# ./configure --sbin-path=/usr/local/nginx/nginx
> --conf-path=/usr/local/nginx/nginx.conf
> --pid-path=/usr/local/nginx/nginx.pid
> --with-http_stub_status_module
> --with-http_ssl_module
> --with-pcre=/root/nginx/pcre-8.40/
> --with-zlib=/root/nginx/zlib-1.2.11
> --with-openssl=/root/nginx/openssl-1.0.2k
> --add-module=/root/nginx/nginx-goodies-nginx-sticky-module-ng/
> --add-module=/root/nginx/nginx_upstream_check_module-0.3.0/

  1. 编译

# make && make install

may you success !

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容