Nginx安装

298 阅读1分钟

centos平台编译环境使用如下指令
安装make:
yum -y install gcc automake autoconf libtool make
安装g++:
yum install gcc gcc-c++ 下面正式开始


[root@localhost bin]# yum -y install gcc automake libtool make
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

  • base: mirrors.123host.vn
  • epel: mirrors.123host.vn
  • extras: mirrors.fibo.vn
  • updates: mirrors.123host.vn
    Setting up Install Process
    Package gcc-4.1.2-55.el5.i386 already installed and latest version
    Package automake-1.9.6-3.el5.noarch already installed and latest version
    Package libtool-1.5.22-7.el5_4.i386 already installed and latest version
    Package 1:make-3.81-3.el5.i386 already installed and latest version
    Nothing to do
    You have new mail in /var/spool/mail/root
    [root@localhost bin]# yum install gcc gcc-c++
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
  • base: mirrors.123host.vn
  • epel: mirrors.123host.vn
  • extras: mirrors.fibo.vn
  • updates: mirrors.123host.vn
    Setting up Install Process
    Package gcc-4.1.2-55.el5.i386 already installed and latest version
    Package gcc-c++-4.1.2-55.el5.i386 already installed and latest version
    Nothing to do
    一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。
    cd /usr/local/src
    99 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz
    100 tar -zxvf pcre-8.34.tar.gz
    101 cd pcre-8.34
    103 ./configure
    104 make
    105 make install
    106 cd /usr/local/src
    107 wget zlib.net/zlib-1.2.8.…
    108 tar -zxvf zlib-1.2.8.tar.gz
    109 cd zlib-1.2.8
    110 ./configure
    111 make
    112 make install
    113 cd /usr/local/src/
    114 wget www.openssl.org/source/open…
    115 tar -zxvf openssl-1.0.1c.tar.gz
    116 wget nginx.org/download/ng…
    117 tar -zxvf nginx-1.7.7.tar.gz
    118 cd nginx-1.7.7
    ./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.34 --with-zlib=/usr/local/src/zlib-1.2.8 --with-openssl=/usr/local/src/openssl-1.0.1c
    151 make
    152 make install

--with-pcre=/usr/src/pcre-8.34 指的是pcre-8.34 的源码路径。
--with-zlib=/usr/src/zlib-1.2.7 指的是zlib-1.2.7 的源码路径。

启动:/usr/local/nginx/sbin/nginx
停止:/usr/local/nginx/sbin/nginx -s quit
重启:/usr/local/nginx/sbin/nginx -s reload