nginx 安装配置

 

 

nginx 安装

1 安装编译工具及库文件

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

2:首先要安装 PCRE

http://jaist.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz

 

tar zxvf pcre-8.39.tar.gz

./configure

 make && make install

 

 3:下载nginx

 

 http://nginx.org/download/nginx-1.11.6.tar.gz

 

 

 

 

我们的nginx基本是全部启用可用的功能,所以依赖多了一些;

准备工作

依赖处理

  • 依赖gd
    yum -y install gd gd-devel
  • 依赖libxml2
    yum -y install libxml2 libxml2-devel
  • 依赖libxslt
    yum -y install libxlst libxlst-devel
  • 依赖pcre
    yum -y install pcre pcre-devel

下载第三方插件

  • 进入temp 目录
    cd /data/temp
  • Cache Purge
    wget http: //scm.im20.com.cn/res/soft/nginx/nginx-3rd-modules/ngx_cache_purge-1.3.tar.gz
    tar zxvf ngx_cache_purge- 1.3 .tar.gz
  • upsstream fair
    wget http: //scm.im20.com.cn/res/soft/nginx/nginx-3rd-modules/gnosek-nginx-upstream-fair-2131c73.tar.gz
    tar zxvf gnosek-nginx-upstream-fair-2131c73.tar.gz
  • healthcheck
    wget http: //scm.im20.com.cn/res/soft/nginx/nginx-3rd-modules/cep21-healthcheck_nginx_upstreams-b33a846.tar.gz
    tar zxvf cep21-healthcheck_nginx_upstreams-b33a846.tar.gz
  • ngx_http_log_request_speed
    wget http: //scm.im20.com.cn/res/soft/nginx/nginx-3rd-modules/Ngx_http_log_request_speed.tar.gz
    tar zxvf Ngx_http_log_request_speed.tar.gz

安装阶段

  • 解压并进入
    tar zxvf nginx-1.0.6.tar.gz
    cd nginx-1.0.6
  • configure
    ./configure \
         --prefix=/data/server/nginx-1.0.6 \
         --with-pcre \
         --with-http_ssl_module \
         --with-http_realip_module \
         --with-http_addition_module \
         --with-http_xslt_module \
         --with-http_image_filter_module \
         --with-http_sub_module \
         --with-http_dav_module \
         --with-http_flv_module \
         --with-http_gzip_static_module \
         --with-http_random_index_module \
         --with-http_secure_link_module \
         --with-http_stub_status_module \
         --with-mail \
         --with-mail_ssl_module \
         --with-md5=/usr/bin/ \
         --with-sha1=/usr/bin/ \
         --add-module=../ngx_cache_purge-1.3/ \
         --add-module=../gnosek-nginx-upstream-fair-2131c73/ \
         --add-module=../ngx_http_log_request_speed/ \
         --with-debug
  • 如果没有错误, 编译安装
    make && make install

获取配置以及使用说明

获取默认配置文件

cd /data/server/nginx- 1.0 . 6 /
mkdir nginx_cache
chown nobody.nobody nginx_cache
cd conf
wget http: //scm.im20.com.cn/res/conf/nginx/nginx-conf-1.0.6.tar
tar xvf nginx-conf- 1.0 . 6 .tar
rm -f nginx-conf- 1.0 . 6 .tar

注释:
所有的配置文件在:/data/server/nginx1.0.6/conf/vhost/下面;
vhost/vhost_demo.im20.com.cn.conf 可以作为基础配置使用, 简单修改即可; 
nginx会自动加载vhost/vhost_*.conf 的文件

for init.d

wget http: //scm.im20.com.cn/res/conf/nginx/nginx.initd-1.0.6
chmod +x nginx.initd- 1.0 . 6
mv nginx.initd- 1.0 . 6 /etc/init.d/nginx
chkconfig --add nginx
chkconfig --level 345 nginx on

使用说明

启动命令:

service nginx start

停止命令:

service nginx start

重新加载配置命令

service nginx reload

服务器端快速安装命令

__sh install_nginx- 1.0 . 6
Labels:

 

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值