#!/bin/bash #install nginx, #1st install gcc-c++, 2nd install openssl,3rd install zlib,4th install pcre,5th install nginx yum install -y gcc automake autoconf libtool make yum install -y gcc gcc-c++ echo '---------------------------------------gcc-c++ install succed---------------' cd /usr/src tar xzvf pcre-8.41.tar.gz tar xzvf zlib-1.2.11.tar.gz tar xzvf openssl-1.1.0f.tar.gz tar xzvf nginx-1.12.1.tar.gz rm -rf pcre-8.41.tar.gz rm -rf zlib-1.2.11.tar.gz rm -rf openssl-1.1.0f.tar.gz rm -rf nginx-1.12.1.tar.gz cd openssl-1.1.0f ./config make make install cd ../zlib-1.2.11 ./configure make make install cd ../pcre-8.41 ./configure make make install cd ../nginx-1.12.1 useradd nginx -s /sbin/nologin ./configure --user=nginx --group=nginx --with-pcre=../pcre-8.41/ --with-zlib=../zlib-1.2.11/ --with-openssl=../openssl-1.1.0f/ make make install cd /usr/local/nginx/sbin/ ./nginx -t
SSL功能需要openssl库,下载地址:http://www.openssl.org/
gzip模块需要zlib库,下载地址:http://www.zlib.net/
rewrite模块需要pcre库,下载地址:http://www.pcre.org/
Nginx的安装包:下载地址为:http://nginx.org/en/download.html
测试:cd /usr/local/sbin ; ./nginx -t
启动:./nginx
停止:kill 进程号
基础条件:
1、配置YUM仓库,本地源光盘镜像
2、openssl , zlib, pcre, nginx 包传入Linux /usr/src目录下