linux-tutorial/codes/deploy/tool/nginx/install-nginx.sh
2018-02-24 10:18:36 +08:00

31 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
###################################################################################
# 安装 nginx 脚本
# 适用于所有 linux 发行版本。
# nginx 会被安装到 /opt/software/nginx 路径。
# 注意:安装 nginx 需要依赖以下库,需预先安装:
# zlib zlib-devel gcc-c++ libtool openssl openssl-devel
# Author: Zhang Peng
###################################################################################
echo -e "\n>>>>>>>>> install nginx"
# 首先要安装 PCREPCRE 作用是让 nginx 支持 Rewrite 功能
pcreRoot=/opt/software/pcre
pcreVersion=8.35
./install-pcre.sh ${pcreRoot} ${pcreVersion}
# 下载并解压 nginx
ngixnRoot=/opt/software/nginx
nginxVersion=1.12.2
mkdir -p ${ngixnRoot}
wget -O ${ngixnRoot}/nginx-${nginxVersion}.tar.gz http://nginx.org/download/nginx-${nginxVersion}.tar.gz
cd ${ngixnRoot}
tar zxvf nginx-${nginxVersion}.tar.gz
# 编译
cd nginx-${nginxVersion}
./configure --with-http_stub_status_module --with-http_ssl_module --with-pcre=${pcreRoot}/pcre-${pcreVersion}
nginx -v