File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4646
4747* JDK 安装和配置:| [ CODES] ( codes/deploy/tool/jdk ) | [ DOCS] ( docs/deploy/tool/jdk/install-jdk.md ) |
4848* Maven 安装和配置:| [ CODES] ( codes/deploy/tool/maven ) | [ DOCS] ( docs/deploy/tool/maven/install-maven.md ) |
49+ * Nginx 安装和配置:| [ CODES] ( codes/deploy/tool/nginx ) | [ DOCS] ( docs/deploy/tool/nginx/install-nginx.md ) |
4950
Original file line number Diff line number Diff line change 1+ # 安装 Nginx
2+
3+ ## linux 安装 nginx 通用脚本
4+
5+ 使用方法:
6+
7+ ``` sh
8+ wget --no-check-certificate --no-cookies https://raw.githubusercontent.com/dunwu/linux/master/codes/deploy/tool/nginx/install-nginx.sh
9+ chmod -R 777 install-nginx.sh
10+ ./install-nginx.sh
11+ ```
12+
13+ 脚本会下载解压 nginx 到 ` /opt/software/nginx ` 路径下。
14+
15+ ## Centos 安装 nginx 脚本
16+
17+ 使用方法:
18+
19+ ``` sh
20+ wget --no-check-certificate --no-cookies https://raw.githubusercontent.com/dunwu/linux/master/codes/deploy/tool/jdk/install-nginx-by-yum.sh
21+ chmod -R 777 install-nginx-by-yum.sh
22+ ./install-nginx-by-yum.sh
23+ ```
24+
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # ##################################################################################
4+ # 安装 nginx 脚本
5+ # 仅适用于 centos 发行版本。
6+ # Author: Zhang Peng
7+ # ##################################################################################
8+
9+ echo -e " \n>>>>>>>>> install nginx"
10+
11+ yum -y install make nginx.x86_64
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # ##################################################################################
4+ # 安装 nginx 脚本
5+ # 适用于所有 linux 发行版本。
6+ # nginx 会被安装到 /opt/software/nginx 路径。
7+ # 注意:安装 nginx 需要依赖以下库,需预先安装:
8+ # zlib zlib-devel gcc-c++ libtool openssl openssl-devel
9+ # Author: Zhang Peng
10+ # ##################################################################################
11+
312echo -e " \n>>>>>>>>> install nginx"
413
5- yum -y install make nginx.x86_64
14+ # 首先要安装 PCRE,PCRE 作用是让 nginx 支持 Rewrite 功能
15+ pcreRoot=/opt/software/pcre
16+ pcreVersion=8.35
17+ ./install-pcre.sh ${pcreRoot} ${pcreVersion}
18+
19+ # 下载并解压 nginx
20+ ngixnRoot=/opt/software/nginx
21+ nginxVersion=1.12.2
22+ mkdir -p ${ngixnRoot}
23+ wget -O ${ngixnRoot} /nginx-${nginxVersion} .tar.gz http://nginx.org/download/nginx-${nginxVersion} .tar.gz
24+ cd ${ngixnRoot}
25+ tar zxvf nginx-${nginxVersion} .tar.gz
26+
27+ # 编译
28+ cd nginx-${nginxVersion}
29+ ./configure --with-http_stub_status_module --with-http_ssl_module --with-pcre=${pcreRoot} /pcre-${pcreVersion}
30+ nginx -v
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # ##################################################################################
4+ # 安装 pcre 脚本
5+ # 适用于所有 linux 发行版本。
6+ # 注意:本脚本需输入根路径和版本号两个参数。
7+ # Author: Zhang Peng
8+ # ##################################################################################
9+
10+ echo -e " \n>>>>>>>>> install pcre"
11+
12+ root=$1
13+ version=$2
14+
15+ # 下载并解压 pcre
16+ mkdir -p ${root}
17+ wget -O ${root} /pcre-${version} .tar.gz http://downloads.sourceforge.net/project/pcre/pcre/${version} /pcre-${version} .tar.gz
18+ cd ${root}
19+ tar zxvf pcre-${version} .tar.gz
20+ cd pcre-${version}
21+
22+ # 编译
23+ ./configure
24+ make && make install
25+ pcre-config --version
Original file line number Diff line number Diff line change 1+ # Nginx 安装
2+
3+ ## 安装方法
4+
5+ ### 安装编译工具及库文件
6+
7+ ```
8+ yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
9+ ```
10+
11+ ### 先安装 PCRE
12+
13+ 安装步骤如下:
14+
15+ (1)下载解压到本地
16+
17+ 进入官网下载地址:https://sourceforge.net/projects/pcre/files/pcre/ ,选择合适的版本下载。
18+
19+ 我选择的是 8.35 版本:http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
20+
21+ ```
22+ wget -O /opt/software/pcre/pcre-8.35.tar.gz http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
23+ cd /opt/software/pcre
24+ tar zxvf pcre-8.35.tar.gz
25+ ```
26+
27+ (2)编译安装
28+
29+ 执行以下命令:
30+
31+ ```
32+ cd /opt/software/pcre/pcre-8.35
33+ ./configure
34+ make && make install
35+ ```
36+
37+ (3)检验是否安装成功
38+
39+ 执行 ` pcre-config --version ` 命令。
40+
41+ ### 安装 Nginx
42+
43+ 安装步骤如下:
44+
45+ (1)下载解压到本地
46+
47+ 进入官网下载地址:http://nginx.org/en/download.html ,选择合适的版本下载。
48+
49+ 我选择的是 1.12.2 版本:http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
50+
51+ ```
52+ wget -O /opt/software/nginx/nginx-1.12.2.tar.gz http://nginx.org/download/nginx-1.12.2.tar.gz
53+ cd /opt/software/nginx
54+ tar zxvf nginx-1.12.2.tar.gz
55+ ```
56+
57+ (2)编译安装
58+
59+ 执行以下命令:
60+
61+ ```
62+ cd /opt/software/nginx/nginx-1.12.2
63+ ./configure --with-http_stub_status_module --with-http_ssl_module --with-pcre=/opt/software/pcre/pcre-8.35
64+ ```
65+
66+ (3)检验是否安装成功
67+
68+ 执行 ` nginx -v ` 命令。
69+
70+ ### 启动 Nginx
71+
72+ 安装成功后,直接执行 ` nginx ` 命令即可启动 nginx。
73+
74+ 启动后,访问站点:
75+
76+ ![ nginx-install.png] ( nginx-install.png )
77+
78+ ## 脚本
79+
80+ | [ 安装脚本] ( https://github.com/dunwu/linux/tree/master/codes/deploy/tool/nginx ) |
You can’t perform that action at this time.
0 commit comments